From 43d221698356675f32bf11d5ee539342aff15480 Mon Sep 17 00:00:00 2001 From: Hongbo Wu Date: Fri, 22 Jul 2022 19:20:14 +0800 Subject: [PATCH] fix test --- packages/api/test/routers/auth.test.ts | 31 +++++++++++++------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/packages/api/test/routers/auth.test.ts b/packages/api/test/routers/auth.test.ts index ad12a3a35..f77100852 100644 --- a/packages/api/test/routers/auth.test.ts +++ b/packages/api/test/routers/auth.test.ts @@ -186,21 +186,18 @@ describe('auth router', () => { }) context('when user is not confirmed', async () => { - let pendingUser: User - before(async () => { - pendingUser = await createTestUser( - 'pending_user', - undefined, - correctPassword, - true - ) - email = pendingUser.email + await getRepository(User).update(user.id, { + status: StatusType.Pending, + }) + email = user.email password = correctPassword }) after(async () => { - await deleteTestUser(pendingUser.name) + await getRepository(User).update(user.id, { + status: StatusType.Active, + }) }) it('redirects with error code PendingVerification', async () => { @@ -232,16 +229,18 @@ describe('auth router', () => { }) context('when user has no password stored in db', async () => { - let socialAccountUser: User - before(async () => { - socialAccountUser = await createTestUser('social_account_user') - email = socialAccountUser.email - password = 'Some password' + await getRepository(User).update(user.id, { + password: '', + }) + email = user.email + password = user.password! }) after(async () => { - await deleteTestUser(socialAccountUser.name) + await getRepository(User).update(user.id, { + password, + }) }) it('redirects with error code WrongSource', async () => {