From 81e6a8678b5f35789da2509271a7be37c195b7bf Mon Sep 17 00:00:00 2001 From: Graham Lee Date: Wed, 25 May 2022 10:17:21 +0100 Subject: [PATCH] Fix test setup for user deletion #2672 The register endpoint logs in the created user, so the last created must be an admin for delete to work. --- verification/curator-service/api/test/users.test.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/verification/curator-service/api/test/users.test.ts b/verification/curator-service/api/test/users.test.ts index 38a8006de..8e7a6ae33 100644 --- a/verification/curator-service/api/test/users.test.ts +++ b/verification/curator-service/api/test/users.test.ts @@ -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