I have started to learn Jasmine because I have to use it in my new Job, but actually I faced problem with understanding clock().tick().
I copied the following spec from jasmine official documentation, actually I don't understand why in the second tick is used 50 instead of 101. Can you explain me why ?
it("causes an interval to be called synchronously", function() {
setInterval(function() {
timerCallback();
}, 100);
expect(timerCallback).not.toHaveBeenCalled();
jasmine.clock().tick(101);
expect(timerCallback.calls.count()).toEqual(1);
jasmine.clock().tick(50);
expect(timerCallback.calls.count()).toEqual(1);
jasmine.clock().tick(50);
expect(timerCallback.calls.count()).toEqual(2);
});
Aucun commentaire:
Enregistrer un commentaire