Open Pietro210 opened 6 years ago
I didn't think about that, but by using setTimeout
we'd end up waiting 10+ seconds for the test to finish.
I think it would be better to mock Date.now
just like you did before.
@Pietro210 feel free to mock Date.now
😃
Done :smiley:
sounds like a good idea to me, and looks finished... can it be merged?
AircraftStore.addMessage()
andAircraftStore.getAircrafts()
now accept an extra argument to set the reference time instead of the current system time.This is useful if we need to add messages in a different order or process a stream of messages received in the past when we know the original times when the messages were received. It adds flexibility and simplifies some of the tests because we can avoid monkey-patching Date.now and waiting a few milliseconds with setTimeout.