test(create-step): state permission conditions explicitly

This commit is contained in:
Ali BARIN
2024-09-10 10:21:42 +00:00
parent 1bcaec144b
commit 82161f028e

View File

@@ -20,12 +20,14 @@ describe('POST /api/v1/flows/:flowId/steps', () => {
roleId: currentUser.roleId, roleId: currentUser.roleId,
subject: 'Flow', subject: 'Flow',
action: 'read', action: 'read',
conditions: ['isCreator'],
}); });
await createPermission({ await createPermission({
roleId: currentUser.roleId, roleId: currentUser.roleId,
subject: 'Flow', subject: 'Flow',
action: 'update', action: 'update',
conditions: ['isCreator'],
}); });
flow = await createFlow({ userId: currentUser.id }); flow = await createFlow({ userId: currentUser.id });
@@ -36,7 +38,7 @@ describe('POST /api/v1/flows/:flowId/steps', () => {
token = await createAuthTokenByUserId(currentUser.id); token = await createAuthTokenByUserId(currentUser.id);
}); });
it('should return created step', async () => { it('should return created step for current user', async () => {
const response = await request(app) const response = await request(app)
.post(`/api/v1/flows/${flow.id}/steps`) .post(`/api/v1/flows/${flow.id}/steps`)
.set('Authorization', token) .set('Authorization', token)