jeudi 3 mars 2016

sandbox.useFakeTimers use cases

sinon.useFakeTimers() can stub global Date constructor new Date()

Which purposes and use cases has sandbox.useFakeTimers ?

From documentation

Fakes timers and binds the clock object to the sandbox such that it too is restored when calling sandbox.restore(). Access through sandbox.clock

it still unclear how to use the second method.

new Date() in SUT still returns original time-stamp

Aucun commentaire:

Enregistrer un commentaire