katowulf / mockfirebase

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

Consider throwing if there is nothing to flush. #38

Closed jamestalmage closed 9 years ago

jamestalmage commented 9 years ago

Mimic the behavior of angulars $timeout.flush(). If it is called and there are no changes to be flushed, it should throw an error. The rationale is that calling flush on an empty queue inside a unit tests indicates that the user has a misunderstanding about the current state of his/her application. Rather than silently ignoring it, this should be brought to the users attention.

bendrucker commented 9 years ago

Yup, I'm with you

katowulf commented 9 years ago

See my comment in the PR.

bendrucker commented 9 years ago

Let's discuss this in a new issue if you can find anything that this breaks, but I made sure it's compatible with autoFlush.

https://github.com/katowulf/mockfirebase/commit/694a2203b4a7c196dd9b9cc045e7a45efec8e16a#commitcomment-8856302