Restrict token look ups by id to not conflict with other tests

This commit is contained in:
James Allen 2018-06-21 11:00:25 +01:00
parent c07ce3bd89
commit de45c08585

View file

@ -34,6 +34,7 @@ describe "UserEmails", ->
(cb) =>
db.tokens.find {
use: 'email_confirmation',
'data.user_id': @user._id,
usedAt: { $exists: false }
}, (error, tokens) =>
# There should only be one confirmation token at the moment
@ -61,6 +62,7 @@ describe "UserEmails", ->
(cb) =>
db.tokens.find {
use: 'email_confirmation',
'data.user_id': @user._id,
usedAt: { $exists: false }
}, (error, tokens) =>
# Token should be deleted after use
@ -85,6 +87,7 @@ describe "UserEmails", ->
(cb) =>
db.tokens.find {
use: 'email_confirmation',
'data.user_id': @user._id,
usedAt: { $exists: false }
}, (error, tokens) =>
# There should only be one confirmation token at the moment
@ -121,6 +124,7 @@ describe "UserEmails", ->
(cb) =>
db.tokens.find {
use: 'email_confirmation',
'data.user_id': @user2._id,
usedAt: { $exists: false }
}, (error, tokens) =>
# The first token has been used, so this should be token2 now
@ -165,6 +169,7 @@ describe "UserEmails", ->
(cb) =>
db.tokens.find {
use: 'email_confirmation',
'data.user_id': @user._id,
usedAt: { $exists: false }
}, (error, tokens) =>
# There should only be one confirmation token at the moment