Skip to content

Commit 39b2b97

Browse files
committed
Address AI review
1 parent 8570b57 commit 39b2b97

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

packages/cli/src/controllers/role.controller.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ export class RoleController {
3737
_res: Response,
3838
@Param('slug') slug: string,
3939
): Promise<RoleDTO> {
40-
console.log('getRoleBySlug', slug);
4140
return await this.roleService.getRole(slug);
4241
}
4342

@@ -72,7 +71,6 @@ export class RoleController {
7271
_res: Response,
7372
@Body createRole: CreateRoleDto,
7473
): Promise<RoleDTO> {
75-
console.log('createRole', createRole);
7674
return await this.roleService.createCustomRole(createRole);
7775
}
7876
}

packages/cli/test/integration/controllers/role.controller-db.test.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ describe('RoleController - Integration Tests', () => {
1616
const testServer = setupTestServer({ endpointGroups: ['role'] });
1717
let ownerAgent: SuperAgentTest;
1818
let memberAgent: SuperAgentTest;
19-
let generatedRoleSlug: string;
2019

2120
beforeAll(async () => {
2221
await testDb.init();
@@ -105,14 +104,23 @@ describe('RoleController - Integration Tests', () => {
105104
systemRole: false,
106105
},
107106
});
108-
109-
generatedRoleSlug = response.body.data.slug;
110107
});
111108

112109
it('should update a custom role', async () => {
113110
//
114111
// ARRANGE
115112
//
113+
const createRoleDto: CreateRoleDto = {
114+
displayName: 'Custom Project Role',
115+
description: 'A custom role for project management',
116+
roleType: 'project',
117+
scopes: ['workflow:read', 'workflow:create'].sort(),
118+
};
119+
120+
const createResponse = await ownerAgent.post('/roles').send(createRoleDto).expect(200);
121+
122+
expect(createResponse.body?.data?.slug).toBeDefined();
123+
116124
const updateRoleDto: UpdateRoleDto = {
117125
displayName: 'Custom Project Role Updated',
118126
description: 'A custom role for project management - updated',
@@ -122,7 +130,7 @@ describe('RoleController - Integration Tests', () => {
122130
// ACT
123131
//
124132
const response = await ownerAgent
125-
.patch(`/roles/${generatedRoleSlug}`)
133+
.patch(`/roles/${createResponse.body.data.slug}`)
126134
.send(updateRoleDto)
127135
.expect(200);
128136

packages/cli/test/integration/controllers/role.controller.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ describe('RoleController', () => {
417417
//
418418
// ACT
419419
//
420-
const response = await ownerAgent.patch(`/roles/${roleSlug}`).send(updateRoleDto);
420+
const response = await ownerAgent.patch(`/roles/${roleSlug}`).send(updateRoleDto).expect(200);
421421

422422
//
423423
// ASSERT

0 commit comments

Comments
 (0)