Fix test case error
This commit is contained in:
parent
5024b50063
commit
a8f30af49d
|
@ -267,19 +267,24 @@ describe('User', function() {
|
|||
});
|
||||
|
||||
it('invalidates the user\'s accessToken when the user is deleted all', function(done) {
|
||||
var usersId, accessTokenId;
|
||||
var userIds = [];
|
||||
var accessTokenId;
|
||||
async.series([
|
||||
function(next) {
|
||||
User.create([{ name: 'myname', email: 'b@c.com', password: 'bar' },
|
||||
{ name: 'myname', email: 'd@c.com', password: 'bar' }], function(err, user) {
|
||||
usersId = user.id;
|
||||
User.create([
|
||||
{ name: 'myname', email: 'b@c.com', password: 'bar' },
|
||||
{ name: 'myname', email: 'd@c.com', password: 'bar' },
|
||||
], function(err, users) {
|
||||
userIds = users.map(function(u) {
|
||||
return u.id;
|
||||
});
|
||||
next(err);
|
||||
});
|
||||
},
|
||||
function(next) {
|
||||
User.login({ email: 'b@c.com', password: 'bar' }, function(err, accessToken) {
|
||||
accessTokenId = accessToken.userId;
|
||||
if (err) return next (err);
|
||||
if (err) return next(err);
|
||||
assert(accessTokenId);
|
||||
next();
|
||||
});
|
||||
|
@ -287,7 +292,7 @@ describe('User', function() {
|
|||
function(next) {
|
||||
User.login({ email: 'd@c.com', password: 'bar' }, function(err, accessToken) {
|
||||
accessTokenId = accessToken.userId;
|
||||
if (err) return next (err);
|
||||
if (err) return next(err);
|
||||
assert(accessTokenId);
|
||||
next();
|
||||
});
|
||||
|
@ -299,9 +304,9 @@ describe('User', function() {
|
|||
},
|
||||
function(next) {
|
||||
User.find({ where: { name: 'myname' }}, function(err, userFound) {
|
||||
if (err) return next (err);
|
||||
if (err) return next(err);
|
||||
expect(userFound.length).to.equal(0);
|
||||
AccessToken.find({ where: { userId: usersId }}, function(err, tokens) {
|
||||
AccessToken.find({ where: { userId: { inq: userIds }}}, function(err, tokens) {
|
||||
if (err) return next(err);
|
||||
expect(tokens.length).to.equal(0);
|
||||
next();
|
||||
|
|
Loading…
Reference in New Issue