From a904e54122d719298dd1ba0796f2d9887a702c3b Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Mon, 18 Nov 2013 23:22:00 -0800 Subject: [PATCH] Fix `_.throttle` and `_.now` tests. --- test/test.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/test/test.js b/test/test.js index c350900af..2119e9d00 100644 --- a/test/test.js +++ b/test/test.js @@ -5091,7 +5091,8 @@ (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, dateCount = 0; + var getTime = function() { + return ++dateCount < 3 ? +new Date : Infinity; + }; + var lodash = _.runInContext(_.assign({}, root, { 'Date': function() { - return { - 'getTime': function() { - return ++dateCount < 3 ? new Date : Object(Infinity); - } - }; + return { 'getTime': getTime, 'valueOf': getTime }; } }));