mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-12 11:57:49 +00:00
Fix _.throttle and _.now tests.
This commit is contained in:
13
test/test.js
13
test/test.js
@@ -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);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user