Skip to content

Commit

Permalink
Fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
th3fallen authored and cjohansen committed Feb 25, 2017
1 parent 5bd7dff commit 0b8a0be
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
9 changes: 7 additions & 2 deletions lolex.js
Expand Up @@ -612,8 +612,13 @@ function createClock(now, loopLimit) {
exports.createClock = createClock;

exports.install = function install(target, now, toFake, loopLimit) {
var i,
l;
var i, l;

if (target instanceof Date) {
toFake = now;
now = target.getTime();
target = null;
}

if (typeof target === "number") {
toFake = now;
Expand Down
9 changes: 2 additions & 7 deletions test/lolex-test.js
Expand Up @@ -45,7 +45,8 @@ describe('issue #73', function() {
it('should install with date object', function () {
var date = new Date('2015-09-25');
var clock = lolex.install(date);
assert.same(date.clock, clock);
assert.same(clock.now, 1443139200000);
clock.uninstall();
});
});

Expand Down Expand Up @@ -1716,12 +1717,6 @@ describe("lolex", function () {
assert.same(setInterval, lolex.timers.setInterval);
assert.same(clearInterval, lolex.timers.clearInterval);
});

it("does not be able to use date object for now", function () {
assert.exception(function () {
lolex.install(new Date(2011, 9, 1));
});
});
});

if (hrtimePresent) {
Expand Down

0 comments on commit 0b8a0be

Please sign in to comment.