From abf772ae870e238a4df0b42bfb082724ebf76dd1 Mon Sep 17 00:00:00 2001 From: Javier Segarra Date: Thu, 16 Nov 2023 10:43:00 +0100 Subject: [PATCH] refs #6434 feat: check if signIn inserts signInLog --- back/methods/vn-user/specs/sign-in.spec.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/back/methods/vn-user/specs/sign-in.spec.js b/back/methods/vn-user/specs/sign-in.spec.js index 26abe7eda..ac2dfe2b2 100644 --- a/back/methods/vn-user/specs/sign-in.spec.js +++ b/back/methods/vn-user/specs/sign-in.spec.js @@ -12,13 +12,16 @@ describe('VnUser Sign-in()', () => { }, args: {} }; - const {VnUser, AccessToken} = models; + const {VnUser, AccessToken, SignInLog} = models; describe('when credentials are correct', () => { it('should return the token if user uses email', async() => { let login = await VnUser.signIn(unauthCtx, 'salesAssistant@mydomain.com', 'nightmare'); let accessToken = await AccessToken.findById(login.token); let ctx = {req: {accessToken: accessToken}}; + let signInLog = await SignInLog.find({where: {token: accessToken.id}}); + expect(signInLog.length).toEqual(1); + expect(signInLog[0].userFk).toEqual(accessToken.userId); expect(login.token).toBeDefined(); await VnUser.logout(ctx.req.accessToken.id);