katowulf / mockfirebase

Firebase mock library for writing unit tests (experimental)
157 stars 40 forks source link

Events should be dequeued after run/cancel #55

Closed bendrucker closed 9 years ago

bendrucker commented 9 years ago

@katowulf Wanted to consult you on what may (but probably won't) be a breaking change. The flush queue is exposing a lot of internal status and I'm not sure that's necessary based on your described use case.

It's bugging me that you can call event.run and then a flag is set that basically makes sure the event gets skipped in a future queue.flush call. This basically amounts to a regression in queue.flush where events that have previously run will prevent the flush queue from throwing. I don't see a good reason why different rules should apply than did before.

cancel should splice the event out of the queue and run should cancel and then call the function. There's some chance this breaks tests where you're using this functionality, but I see that as revealing a bug rather than a true breaking change.

katowulf commented 9 years ago

Agreed; an oversight on my refactor of the flush queue. I don't think it breaks any of my code to make this change, if it does then that's probably a bug, too.

bendrucker commented 9 years ago

Cool I'll knock this out as a patch this evening