This commit is contained in:
parent
253465cf13
commit
25b5c35dc6
|
@ -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);
|
||||||
|
|
|
@ -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() => {
|
||||||
|
|
Loading…
Reference in New Issue