refs #6835 fix: issue
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Javier Segarra 2024-04-15 08:47:49 +02:00
parent 253465cf13
commit 25b5c35dc6
2 changed files with 13 additions and 1 deletions

View File

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

View File

@ -33,6 +33,17 @@ describe('Renew Token', () => {
const {id} = await models.VnUser.renewToken(ctx);
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() => {