Correct test to check req status after function is finished.

This commit is contained in:
Blade Barringer
2015-11-13 09:21:22 -06:00
parent eab9d7b3ba
commit 939bc893c6
2 changed files with 4 additions and 4 deletions

View File

@@ -82,8 +82,9 @@ describe('getUserLanguage', () => {
userId: 123
};
getUserLanguage(req, res, next);
expect(req.language).to.equal('it');
getUserLanguage(req, res, () => {
expect(req.language).to.equal('it');
});
});
});
});

View File

@@ -75,7 +75,6 @@ export default function getUserLanguage (req, res, next) {
.exec()
.then((user) => {
req.language = _getFromUser(user, req);
console.log(req.language);
return next();
})
.catch(next);
@@ -83,4 +82,4 @@ export default function getUserLanguage (req, res, next) {
req.language = _getFromUser(null, req);
return next();
}
}
}