refs #6434 feat: check if signIn inserts signInLog
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Javier Segarra 2023-11-16 10:43:00 +01:00
parent 386b556216
commit abf772ae87
1 changed files with 4 additions and 1 deletions

View File

@ -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);