Add test for Jasmine's jasmine.clock().mockDate(baseTime)

This commit is contained in:
David Pärsson 2015-08-05 09:47:32 +02:00
parent 147cc7a8b3
commit bcf0b2807b

View File

@ -721,6 +721,17 @@ describe("Manually ticking the Jasmine Clock", function () {
jasmine.clock().tick(50);
expect(timerCallback.calls.count()).toEqual(2);
});
describe("Mocking the Date object", function(){
it("mocks the Date object and sets it to a given time", function() {
var baseTime = new Date(2013, 9, 23);
jasmine.clock().mockDate(baseTime);
jasmine.clock().tick(50);
expect(new Date().getTime()).toEqual(baseTime.getTime() + 50);
});
});
});
describe("Asynchronous specs", function () {