diff --git a/src/lib/middleware/demo-authentication.test.ts b/src/lib/middleware/demo-authentication.test.ts index d0dbb0d37063..3863afde5638 100644 --- a/src/lib/middleware/demo-authentication.test.ts +++ b/src/lib/middleware/demo-authentication.test.ts @@ -9,7 +9,7 @@ let stores: IUnleashStores; beforeAll(async () => { db = await dbInit('demo_auth_serial'); stores = db.stores; -}, 20000); +}); afterAll(async () => { await db?.destroy(); @@ -24,21 +24,6 @@ const getApp = (adminLoginEnabled: boolean) => }, }); -test('should allow login with admin user if flag enabled', async () => { - const app = await getApp(true); - return ( - app.request - .post(`/auth/demo/login`) - .send({ email: 'admin' }) - // .expect(200) - .expect((res) => { - expect(res.body).toBe(''); // TODO remove this - debugging - expect(res.body.id).toBe(1); - expect(res.body.username).toBe('admin'); - }) - ); -}); - test('should create regular user with flag enabled', async () => { const app = await getApp(true); return app.request @@ -58,3 +43,15 @@ test('should return 403 for admin user if flag disabled', async () => { .send({ email: 'admin' }) .expect(403); }); + +test('should allow login with admin user if flag enabled', async () => { + const app = await getApp(true); + return app.request + .post(`/auth/demo/login`) + .send({ email: 'admin' }) + .expect(200) + .expect((res) => { + expect(res.body.id).toBe(1); + expect(res.body.username).toBe('admin'); + }); +});