7299_testToMaster #2411

Merged
alexm merged 342 commits from 7299_testToMaster into master 2024-05-07 05:30:42 +00:00
2 changed files with 13 additions and 1 deletions
Showing only changes of commit 25b5c35dc6 - Show all commits

View File

@ -33,7 +33,8 @@ module.exports = Self => {
// Schedule to remove current token // Schedule to remove current token
setTimeout(async() => { setTimeout(async() => {
try { try {
await Self.logout(token.id); const exists = await models.AccessToken.findById(token.id);
exists && await Self.logout(token.id);
} catch (err) { } catch (err) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.error(err); console.error(err);

View File

@ -33,6 +33,17 @@ describe('Renew Token', () => {
const {id} = await models.VnUser.renewToken(ctx); const {id} = await models.VnUser.renewToken(ctx);
expect(id).not.toEqual(ctx.req.accessToken.id); expect(id).not.toEqual(ctx.req.accessToken.id);
await models.VnUser.logout(ctx.req.accessToken.id);
jasmine.clock().tick(70 * 1000);
let tokenNotExists;
try {
tokenNotExists = await models.AccessToken.findById(ctx.req.accessToken.id);
} catch (e) {
error = e;
}
expect(tokenNotExists).toBeNull();
}); });
it('NOT should renew', async() => { it('NOT should renew', async() => {