Skip to content

Commit

Permalink
fix: rename variables project2 and 3 to 1 and 2
Browse files Browse the repository at this point in the history
  • Loading branch information
daveleek committed Jul 8, 2024
1 parent 35ea6e2 commit 52bdea5
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions src/lib/features/project/project-service.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2492,13 +2492,13 @@ test('deleting a project with archived flags should result in any remaining arch
});

test('should also delete api tokens that were only bound to deleted project', async () => {
const project2 = 'some';
const project = 'some';
const tokenName = 'test';

await projectService.createProject(
{
id: project2,
name: 'Test Project 2',
id: project,
name: 'Test Project 1',
},
user,
auditUser,
Expand All @@ -2508,32 +2508,32 @@ test('should also delete api tokens that were only bound to deleted project', as
type: ApiTokenType.CLIENT,
tokenName,
environment: DEFAULT_ENV,
project: project2,
project: project,
});

await projectService.deleteProject(project2, user, auditUser);
await projectService.deleteProject(project, user, auditUser);
const deletedToken = await apiTokenService.getToken(token.secret);
expect(deletedToken).toBeUndefined();
});

test('should not delete project bound api tokens still bound to project', async () => {
const project2 = 'token-deleted-project';
const project3 = 'token-not-deleted-project';
const project1 = 'token-deleted-project';
const project2 = 'token-not-deleted-project';
const tokenName = 'test';

await projectService.createProject(
{
id: project2,
name: 'Test Project 2',
id: project1,
name: 'Test Project 1',
},
user,
auditUser,
);

await projectService.createProject(
{
id: project3,
name: 'Test Project 3',
id: project2,
name: 'Test Project 2',
},
user,
auditUser,
Expand All @@ -2543,33 +2543,33 @@ test('should not delete project bound api tokens still bound to project', async
type: ApiTokenType.CLIENT,
tokenName,
environment: DEFAULT_ENV,
projects: [project2, project3],
projects: [project1, project2],
});

await projectService.deleteProject(project2, user, auditUser);
await projectService.deleteProject(project1, user, auditUser);
const fetchedToken = await apiTokenService.getToken(token.secret);
expect(fetchedToken).not.toBeUndefined();
expect(fetchedToken.project).toBe(project3);
expect(fetchedToken.project).toBe(project2);
});

test('should delete project bound api tokens when all projects they belong to are deleted', async () => {
const project2 = 'token-deleted-project-1';
const project3 = 'token-deleted-project-2';
const project1 = 'token-deleted-project-1';
const project2 = 'token-deleted-project-2';
const tokenName = 'test';

await projectService.createProject(
{
id: project2,
name: 'Test Project 2',
id: project1,
name: 'Test Project 1',
},
user,
auditUser,
);

await projectService.createProject(
{
id: project3,
name: 'Test Project 3',
id: project2,
name: 'Test Project 2',
},
user,
auditUser,
Expand All @@ -2579,11 +2579,11 @@ test('should delete project bound api tokens when all projects they belong to ar
type: ApiTokenType.CLIENT,
tokenName,
environment: DEFAULT_ENV,
projects: [project2, project3],
projects: [project1, project2],
});

await projectService.deleteProject(project1, user, auditUser);
await projectService.deleteProject(project2, user, auditUser);
await projectService.deleteProject(project3, user, auditUser);
const fetchedToken = await apiTokenService.getToken(token.secret);
expect(fetchedToken).toBeUndefined();
});
Expand Down

0 comments on commit 52bdea5

Please sign in to comment.