tests: solved expire numeric token

This commit is contained in:
Gabriel Grubba
2022-12-08 14:44:00 -03:00
parent f69005813e
commit 02fc0f0531

View File

@@ -263,13 +263,13 @@ Tinytest.addAsync('accounts - insertUserDoc email', async test => {
});
// More token expiration tests are in accounts-password
Tinytest.addAsync('accounts - expire numeric token', (test, onComplete) => {
Tinytest.addAsync('accounts - expire numeric token', async (test, onComplete) => {
const userIn = { username: Random.id() };
const userId = Accounts.insertUserDoc({ profile: {
const userId = await Accounts.insertUserDoc({ profile: {
name: 'Foo Bar'
} }, userIn);
const date = new Date(new Date() - 5000);
Meteor.users.update(userId, {
await Meteor.users.update(userId, {
$set: {
"services.resume.loginTokens": [{
hashedToken: Random.id(),
@@ -280,7 +280,7 @@ Tinytest.addAsync('accounts - expire numeric token', (test, onComplete) => {
}]
}
});
const observe = Meteor.users.find(userId).observe({
const observe = await Meteor.users.find(userId).observe({
changed: newUser => {
if (newUser.services && newUser.services.resume &&
(!newUser.services.resume.loginTokens ||
@@ -290,7 +290,7 @@ Tinytest.addAsync('accounts - expire numeric token', (test, onComplete) => {
}
}
});
Accounts._expireTokens(new Date(), userId);
await Accounts._expireTokens(new Date(), userId);
});