Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(core): Align test names with route names (no-changelog) #9518

Merged
merged 1 commit into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ describe('router should switch based on flag', () => {
});
});

describe('PUT /workflows/:id', () => {
test('PUT /workflows/:id/share should save sharing with new users', async () => {
describe('PUT /workflows/:workflowId/share', () => {
test('should save sharing with new users', async () => {
const workflow = await createWorkflow({}, owner);

const response = await authOwnerAgent
Expand All @@ -126,7 +126,7 @@ describe('PUT /workflows/:id', () => {
);
});

test('PUT /workflows/:id/share should succeed when sharing with invalid user-id', async () => {
test('should succeed when sharing with invalid user-id', async () => {
const workflow = await createWorkflow({}, owner);

const response = await authOwnerAgent
Expand All @@ -139,7 +139,7 @@ describe('PUT /workflows/:id', () => {
expect(sharedWorkflows).toHaveLength(1);
});

test('PUT /workflows/:id/share should allow sharing with pending users', async () => {
test('should allow sharing with pending users', async () => {
const workflow = await createWorkflow({}, owner);
const memberShell = await createUserShell('global:member');
const memberShellPersonalProject = await projectRepository.getPersonalProjectForUserOrFail(
Expand All @@ -157,7 +157,7 @@ describe('PUT /workflows/:id', () => {
expect(mailer.notifyWorkflowShared).toHaveBeenCalledTimes(1);
});

test('PUT /workflows/:id/share should allow sharing with multiple users', async () => {
test('should allow sharing with multiple users', async () => {
const workflow = await createWorkflow({}, owner);

const response = await authOwnerAgent
Expand All @@ -171,7 +171,7 @@ describe('PUT /workflows/:id', () => {
expect(mailer.notifyWorkflowShared).toHaveBeenCalledTimes(1);
});

test('PUT /workflows/:id/share should override sharing', async () => {
test('should override sharing', async () => {
const workflow = await createWorkflow({}, owner);

const response = await authOwnerAgent
Expand All @@ -193,7 +193,7 @@ describe('PUT /workflows/:id', () => {
expect(mailer.notifyWorkflowShared).toHaveBeenCalledTimes(2);
});

test('PUT /workflows/:id/share should allow sharing by the owner of the workflow', async () => {
test('should allow sharing by the owner of the workflow', async () => {
const workflow = await createWorkflow({}, member);

const response = await authMemberAgent
Expand All @@ -207,7 +207,7 @@ describe('PUT /workflows/:id', () => {
expect(mailer.notifyWorkflowShared).toHaveBeenCalledTimes(1);
});

test('PUT /workflows/:id/share should allow sharing by the instance owner', async () => {
test('should allow sharing by the instance owner', async () => {
const workflow = await createWorkflow({}, member);

const response = await authOwnerAgent
Expand All @@ -221,7 +221,7 @@ describe('PUT /workflows/:id', () => {
expect(mailer.notifyWorkflowShared).toHaveBeenCalledTimes(1);
});

test('PUT /workflows/:id/share should not allow sharing by another shared member', async () => {
test('should not allow sharing by another shared member', async () => {
const workflow = await createWorkflow({}, member);

await shareWorkflowWithUsers(workflow, [anotherMember]);
Expand All @@ -237,7 +237,7 @@ describe('PUT /workflows/:id', () => {
expect(mailer.notifyWorkflowShared).toHaveBeenCalledTimes(0);
});

test('PUT /workflows/:id/share should not allow sharing with self by another non-shared member', async () => {
test('should not allow sharing with self by another non-shared member', async () => {
const workflow = await createWorkflow({}, member);

const response = await authAnotherMemberAgent
Expand All @@ -251,7 +251,7 @@ describe('PUT /workflows/:id', () => {
expect(mailer.notifyWorkflowShared).toHaveBeenCalledTimes(0);
});

test('PUT /workflows/:id/share should not allow sharing by another non-shared member', async () => {
test('should not allow sharing by another non-shared member', async () => {
const workflow = await createWorkflow({}, member);

const tempUser = await createUser({ role: 'global:member' });
Expand Down Expand Up @@ -302,20 +302,20 @@ describe('GET /workflows/new', () => {
});
});

describe('GET /workflows/:id', () => {
test('GET should fail with invalid id due to route rule', async () => {
describe('GET /workflows/:workflowId', () => {
test('should fail with invalid id due to route rule', async () => {
const response = await authOwnerAgent.get('/workflows/potatoes');

expect(response.statusCode).toBe(404);
});

test('GET should return 404 for non existing workflow', async () => {
test('should return 404 for non existing workflow', async () => {
const response = await authOwnerAgent.get('/workflows/9001');

expect(response.statusCode).toBe(404);
});

test('GET should return a workflow with owner', async () => {
test('should return a workflow with owner', async () => {
const workflow = await createWorkflow({}, owner);

const response = await authOwnerAgent.get(`/workflows/${workflow.id}`).expect(200);
Expand Down Expand Up @@ -343,7 +343,7 @@ describe('GET /workflows/:id', () => {
});
});

test('GET should return shared workflow with user data', async () => {
test('should return shared workflow with user data', async () => {
const workflow = await createWorkflow({}, owner);
await shareWorkflowWithUsers(workflow, [member]);

Expand All @@ -364,7 +364,7 @@ describe('GET /workflows/:id', () => {
});
});

test('GET should return all sharees', async () => {
test('should return all sharees', async () => {
const workflow = await createWorkflow({}, owner);
await shareWorkflowWithUsers(workflow, [member, anotherMember]);

Expand All @@ -380,7 +380,7 @@ describe('GET /workflows/:id', () => {
expect(responseWorkflow.sharedWithProjects).toHaveLength(2);
});

test('GET should return workflow with credentials owned by user', async () => {
test('should return workflow with credentials owned by user', async () => {
const savedCredential = await saveCredential(randomCredentialPayload(), { user: owner });

const workflowPayload = makeWorkflow({
Expand All @@ -404,7 +404,7 @@ describe('GET /workflows/:id', () => {
expect(responseWorkflow.sharedWithProjects).toHaveLength(0);
});

test('GET should return workflow with credentials saying owner does not have access when not shared', async () => {
test('should return workflow with credentials saying owner does not have access when not shared', async () => {
const savedCredential = await saveCredential(randomCredentialPayload(), { user: member });

const workflowPayload = makeWorkflow({
Expand All @@ -427,7 +427,7 @@ describe('GET /workflows/:id', () => {
expect(responseWorkflow.sharedWithProjects).toHaveLength(0);
});

test('GET should return workflow with credentials for all users with or without access', async () => {
test('should return workflow with credentials for all users with or without access', async () => {
const savedCredential = await saveCredential(randomCredentialPayload(), { user: member });

const workflowPayload = makeWorkflow({
Expand Down Expand Up @@ -464,7 +464,7 @@ describe('GET /workflows/:id', () => {
expect(member2Workflow.sharedWithProjects).toHaveLength(1);
});

test('GET should return workflow with credentials for all users with access', async () => {
test('should return workflow with credentials for all users with access', async () => {
const savedCredential = await saveCredential(randomCredentialPayload(), { user: member });
// Both users have access to the credential (none is owner)
await shareCredentialWithUsers(savedCredential, [anotherMember]);
Expand Down Expand Up @@ -659,7 +659,7 @@ describe('POST /workflows', () => {
});
});

describe('PATCH /workflows/:id - validate credential permissions to user', () => {
describe('PATCH /workflows/:workflowId - validate credential permissions to user', () => {
it('Should succeed when saving unchanged workflow nodes', async () => {
const savedCredential = await saveCredential(randomCredentialPayload(), { user: owner });
const workflow = {
Expand Down Expand Up @@ -891,7 +891,7 @@ describe('PATCH /workflows/:id - validate credential permissions to user', () =>
});
});

describe('PATCH /workflows/:id - validate interim updates', () => {
describe('PATCH /workflows/:workflowId - validate interim updates', () => {
it('should block owner updating workflow nodes on interim update by member', async () => {
// owner creates and shares workflow

Expand Down Expand Up @@ -1080,7 +1080,7 @@ describe('PATCH /workflows/:id - validate interim updates', () => {
});
});

describe('PATCH /workflows/:id - workflow history', () => {
describe('PATCH /workflows/:workflowId - workflow history', () => {
test('Should create workflow history version when licensed', async () => {
license.enable('feat:workflowHistory');
const workflow = await createWorkflow({}, owner);
Expand Down Expand Up @@ -1190,7 +1190,7 @@ describe('PATCH /workflows/:id - workflow history', () => {
});
});

describe('PATCH /workflows/:id - activate workflow', () => {
describe('PATCH /workflows/:workflowId - activate workflow', () => {
test('should activate workflow without changing version ID', async () => {
license.disable('feat:workflowHistory');
const workflow = await createWorkflow({}, owner);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ describe('POST /workflows', () => {
});
});

describe('GET /workflows/:id', () => {
describe('GET /workflows/:workflowId', () => {
test('should return pin data', async () => {
const workflow = makeWorkflow({ withPinData: true });
const workflowCreationResponse = await authOwnerAgent.post('/workflows').send(workflow);
Expand Down Expand Up @@ -823,7 +823,7 @@ describe('GET /workflows', () => {
});
});

describe('PATCH /workflows/:id', () => {
describe('PATCH /workflows/:workflowId', () => {
test('should create workflow history version when licensed', async () => {
license.enable('feat:workflowHistory');
const workflow = await createWorkflow({}, owner);
Expand Down Expand Up @@ -997,7 +997,7 @@ describe('PATCH /workflows/:id', () => {
});
});

describe('POST /workflows/run', () => {
describe('POST /workflows/:workflowId/run', () => {
let sharingSpy: jest.SpyInstance;
let tamperingSpy: jest.SpyInstance;
let workflow: WorkflowEntity;
Expand Down Expand Up @@ -1028,7 +1028,7 @@ describe('POST /workflows/run', () => {
});
});

describe('DELETE /workflows/:id', () => {
describe('DELETE /workflows/:workflowId', () => {
test('deletes a workflow owned by the user', async () => {
const workflow = await createWorkflow({}, owner);

Expand Down
Loading