Skip to content

Commit

Permalink
Fix test setup for user deletion #2672
Browse files Browse the repository at this point in the history
The register endpoint logs in the created user, so the last created must be an admin for delete to work.
  • Loading branch information
iamleeg committed May 25, 2022
1 parent 2dc771b commit 81e6a86
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions verification/curator-service/api/test/users.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,19 +153,18 @@ describe('PUT', () => {
});
});


describe('DELETE', () => {
it('should delete a user', async () => {
const request = supertest.agent(app);
const userRes = await request
.post('/auth/register')
.send({ ...baseUser, ...{ roles: ['admin'] } })
.expect(200, /admin/)
.send({ ...baseUser, ...{ roles: [] } })
.expect(200)
.expect('Content-Type', /json/);
const userRes2 = await request
.post('/auth/register')
.send({ ...baseUser, ...{ roles: [] } })
.expect(200)
.send({ ...baseUser, ...{ roles: ['admin'] } })
.expect(200, /admin/)
.expect('Content-Type', /json/);

const res = await request
Expand Down

0 comments on commit 81e6a86

Please sign in to comment.