Timestamp NYT userInfo object
This commit is contained in:
Родитель
a82bc20a32
Коммит
db3b444735
|
@ -43,6 +43,7 @@ exports.NYTUtils = {
|
|||
if (response.status >= 200 && response.status < 300) {
|
||||
let userInfo = response.json;
|
||||
userInfo.visitCount = this._extractVisitCount();
|
||||
userInfo.timeStamp = Date.now();
|
||||
// we must persist userInfo to avoid a situation when dispatcher
|
||||
// is making a payload but response from NYT has not arrvied yet
|
||||
// In which case, we should use data stored previously
|
||||
|
|
|
@ -56,6 +56,10 @@ exports["test fetchNYTUserData"] = function test_fetchNYTUserData(assert, done)
|
|||
server.stop(function(){});
|
||||
// add visit count to expected jason user info
|
||||
responseJSON.visitCount = 20;
|
||||
// ensure userInfo is timestamped
|
||||
assert.ok(userInfo.timeStamp);
|
||||
// add it to the expected response
|
||||
responseJSON.timeStamp = userInfo.timeStamp;
|
||||
testUtils.isIdentical(assert, userInfo, responseJSON);
|
||||
}).then(done);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче