Process all remaining re-frame events

Is there a way to force re-frame to process all remaining events (and ensuing events)? I would like to do this at the end of an async re-frame test. I suspect there is an obvious answer to this but I cannot find it.

I’ve never done that, but IIRC an async test provides you a callback that you should call upon a completion of all events. Then, what you can do is e.g. set up a global interceptor for tests that simply checks the event queue. If it’s empty (and maybe if some global flag is set, if you need an additional check), it will call that callback.

Actually the (done) function is not available in re-frame’s async test. But maybe I could use a global intercept anyway.

What do you mean by “re-frame’s async test”?

By the done function I meant the one from here: ClojureScript - Testing

I’m using run-test-async macro in GitHub - day8/re-frame-test: Cross platform (cljs and clj) utilities for testing re-frame applications. It relies on the done function but does not expose it. But nevertheless I should be able to use a global interceptor as you suggested. For example, it could dispatch a final :no-events-pending event that I await at the end of the test. So thanks!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.