This commit is contained in:
Maxim Zhilyaev 2014-01-30 11:26:12 -08:00 коммит произвёл Edward Lee
Родитель a82bc20a32
Коммит db3b444735
2 изменённых файлов: 5 добавлений и 0 удалений

Просмотреть файл

@ -43,6 +43,7 @@ exports.NYTUtils = {
if (response.status >= 200 && response.status < 300) { if (response.status >= 200 && response.status < 300) {
let userInfo = response.json; let userInfo = response.json;
userInfo.visitCount = this._extractVisitCount(); userInfo.visitCount = this._extractVisitCount();
userInfo.timeStamp = Date.now();
// we must persist userInfo to avoid a situation when dispatcher // we must persist userInfo to avoid a situation when dispatcher
// is making a payload but response from NYT has not arrvied yet // is making a payload but response from NYT has not arrvied yet
// In which case, we should use data stored previously // In which case, we should use data stored previously

Просмотреть файл

@ -56,6 +56,10 @@ exports["test fetchNYTUserData"] = function test_fetchNYTUserData(assert, done)
server.stop(function(){}); server.stop(function(){});
// add visit count to expected jason user info // add visit count to expected jason user info
responseJSON.visitCount = 20; 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); testUtils.isIdentical(assert, userInfo, responseJSON);
}).then(done); }).then(done);
} }