# Process all remaining re-frame events

**URL:** https://clojureverse.org/t/process-all-remaining-re-frame-events/8403
**Category:** How to?
**Tags:** re-frame, clojurescript
**Created:** [December 5, 2021, 9:57am UTC](https://clojureverse.org/t/process-all-remaining-re-frame-events/8403 "2021-12-05T09:57:24Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![DrLjotsson](https://clojureverse.org/user_avatar/clojureverse.org/drljotsson/32/2602_2.png) [@DrLjotsson](https://clojureverse.org/u/DrLjotsson)
#### Post date: [December 5, 2021, 9:57am UTC](https://clojureverse.org/t/process-all-remaining-re-frame-events/8403/1 "2021-12-05T09:57:24Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![p-himik](https://clojureverse.org/user_avatar/clojureverse.org/p-himik/32/4137_2.png) [@p-himik](https://clojureverse.org/u/p-himik)
#### Post date: [December 5, 2021, 2:05pm UTC](https://clojureverse.org/t/process-all-remaining-re-frame-events/8403/2 "2021-12-05T14:05:25Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![DrLjotsson](https://clojureverse.org/user_avatar/clojureverse.org/drljotsson/32/2602_2.png) [@DrLjotsson](https://clojureverse.org/u/DrLjotsson)
#### Post date: [December 5, 2021, 5:32pm UTC](https://clojureverse.org/t/process-all-remaining-re-frame-events/8403/3 "2021-12-05T17:32:39Z")

</div>

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

---

<div class="post-metadata">

### Author: ![p-himik](https://clojureverse.org/user_avatar/clojureverse.org/p-himik/32/4137_2.png) [@p-himik](https://clojureverse.org/u/p-himik)
#### Post date: [December 5, 2021, 5:51pm UTC](https://clojureverse.org/t/process-all-remaining-re-frame-events/8403/4 "2021-12-05T17:51:30Z")

</div>

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

By the `done` function I meant the one from here: [ClojureScript - Testing](https://clojurescript.org/tools/testing#async-testing)

---

<div class="post-metadata">

### Author: ![DrLjotsson](https://clojureverse.org/user_avatar/clojureverse.org/drljotsson/32/2602_2.png) [@DrLjotsson](https://clojureverse.org/u/DrLjotsson)
#### Post date: [December 6, 2021, 3:29pm UTC](https://clojureverse.org/t/process-all-remaining-re-frame-events/8403/5 "2021-12-06T15:29:45Z")

</div>

I’m using `run-test-async` macro in [GitHub - day8/re-frame-test: Cross platform (cljs and clj) utilities for testing re-frame applications](https://github.com/day8/re-frame-test). 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!

---

<div class="post-metadata">

### Author: ![system](https://clojureverse.org/uploads/default/original/2X/5/51079bf9e4b7d9466242c06cf1e43b9f8bd6da14.png) [@system](https://clojureverse.org/u/system)
#### Post date: [June 7, 2022, 3:29am UTC](https://clojureverse.org/t/process-all-remaining-re-frame-events/8403/6 "2022-06-07T03:29:56Z")

</div>

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