test(update-flow): align user role permissions
This commit is contained in:
@@ -25,7 +25,7 @@ describe('PATCH /api/v1/flows/:flowId', () => {
|
|||||||
action: 'read',
|
action: 'read',
|
||||||
subject: 'Flow',
|
subject: 'Flow',
|
||||||
roleId: currentUserRole.id,
|
roleId: currentUserRole.id,
|
||||||
conditions: [],
|
conditions: ['isCreator'],
|
||||||
});
|
});
|
||||||
|
|
||||||
await createPermission({
|
await createPermission({
|
||||||
@@ -35,13 +35,11 @@ describe('PATCH /api/v1/flows/:flowId', () => {
|
|||||||
conditions: ['isCreator'],
|
conditions: ['isCreator'],
|
||||||
});
|
});
|
||||||
|
|
||||||
const newFlowName = 'Updated flow';
|
|
||||||
|
|
||||||
const response = await request(app)
|
const response = await request(app)
|
||||||
.patch(`/api/v1/flows/${currentUserFlow.id}`)
|
.patch(`/api/v1/flows/${currentUserFlow.id}`)
|
||||||
.set('Authorization', token)
|
.set('Authorization', token)
|
||||||
.send({
|
.send({
|
||||||
name: newFlowName,
|
name: 'Updated flow',
|
||||||
})
|
})
|
||||||
.expect(200);
|
.expect(200);
|
||||||
|
|
||||||
@@ -49,7 +47,7 @@ describe('PATCH /api/v1/flows/:flowId', () => {
|
|||||||
|
|
||||||
const expectedPayload = await getFlowMock({
|
const expectedPayload = await getFlowMock({
|
||||||
...refetchedCurrentUserFlow,
|
...refetchedCurrentUserFlow,
|
||||||
name: newFlowName,
|
name: 'Updated flow',
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(response.body).toStrictEqual(expectedPayload);
|
expect(response.body).toStrictEqual(expectedPayload);
|
||||||
@@ -96,14 +94,14 @@ describe('PATCH /api/v1/flows/:flowId', () => {
|
|||||||
action: 'read',
|
action: 'read',
|
||||||
subject: 'Flow',
|
subject: 'Flow',
|
||||||
roleId: currentUserRole.id,
|
roleId: currentUserRole.id,
|
||||||
conditions: [],
|
conditions: ['isCreator'],
|
||||||
});
|
});
|
||||||
|
|
||||||
await createPermission({
|
await createPermission({
|
||||||
action: 'update',
|
action: 'update',
|
||||||
subject: 'Flow',
|
subject: 'Flow',
|
||||||
roleId: currentUserRole.id,
|
roleId: currentUserRole.id,
|
||||||
conditions: [],
|
conditions: ['isCreator'],
|
||||||
});
|
});
|
||||||
|
|
||||||
const notExistingFlowUUID = Crypto.randomUUID();
|
const notExistingFlowUUID = Crypto.randomUUID();
|
||||||
@@ -119,14 +117,14 @@ describe('PATCH /api/v1/flows/:flowId', () => {
|
|||||||
action: 'read',
|
action: 'read',
|
||||||
subject: 'Flow',
|
subject: 'Flow',
|
||||||
roleId: currentUserRole.id,
|
roleId: currentUserRole.id,
|
||||||
conditions: [],
|
conditions: ['isCreator'],
|
||||||
});
|
});
|
||||||
|
|
||||||
await createPermission({
|
await createPermission({
|
||||||
action: 'update',
|
action: 'update',
|
||||||
subject: 'Flow',
|
subject: 'Flow',
|
||||||
roleId: currentUserRole.id,
|
roleId: currentUserRole.id,
|
||||||
conditions: [],
|
conditions: ['isCreator'],
|
||||||
});
|
});
|
||||||
|
|
||||||
await request(app)
|
await request(app)
|
||||||
@@ -142,7 +140,7 @@ describe('PATCH /api/v1/flows/:flowId', () => {
|
|||||||
action: 'read',
|
action: 'read',
|
||||||
subject: 'Flow',
|
subject: 'Flow',
|
||||||
roleId: currentUserRole.id,
|
roleId: currentUserRole.id,
|
||||||
conditions: [],
|
conditions: ['isCreator'],
|
||||||
});
|
});
|
||||||
|
|
||||||
await createPermission({
|
await createPermission({
|
||||||
|
Reference in New Issue
Block a user