mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
tests: solved expire numeric token
This commit is contained in:
@@ -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);
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user