From 8e1020f13447848c9bae83b694c4f9c67b97c62b Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sun, 1 Dec 2013 19:48:02 -0600 Subject: [PATCH] Tweak `_.now` unit test. --- test/test.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/test/test.js b/test/test.js index 0c8e309cc..c776710de 100644 --- a/test/test.js +++ b/test/test.js @@ -5429,9 +5429,22 @@ QUnit.module('lodash.now'); (function() { - test('should return the number of milliseconds that have elapsed since the Unix epoch', 1, function() { - var actual = _.now(); - ok(new Date - actual < 4); + asyncTest('should return the number of milliseconds that have elapsed since the Unix epoch', 2, function() { + var stamp = +new Date, + actual = _.now(); + + ok(actual >= stamp); + + if (!(isRhino && isModularize)) { + setTimeout(function() { + ok(_.now() > actual); + QUnit.start(); + }, 32); + } + else { + skipTest(); + QUnit.start(); + } }); }());