Fix _.throttle and _.now tests.

This commit is contained in:
John-David Dalton
2013-11-18 23:22:00 -08:00
parent 2a97655a8d
commit a904e54122

View File

@@ -5091,7 +5091,8 @@
(function() { (function() {
test('should return the number of milliseconds that have elapsed since the Unix epoch', 1, function() { test('should return the number of milliseconds that have elapsed since the Unix epoch', 1, function() {
strictEqual(_.now(), +new Date); var actual = _.now();
ok(new Date - actual < 4);
}); });
}()); }());
@@ -6918,13 +6919,13 @@
var callCount = 0, var callCount = 0,
dateCount = 0; dateCount = 0;
var getTime = function() {
return ++dateCount < 3 ? +new Date : Infinity;
};
var lodash = _.runInContext(_.assign({}, root, { var lodash = _.runInContext(_.assign({}, root, {
'Date': function() { 'Date': function() {
return { return { 'getTime': getTime, 'valueOf': getTime };
'getTime': function() {
return ++dateCount < 3 ? new Date : Object(Infinity);
}
};
} }
})); }));