Fork me on GitHub

hi everyone. a quick question - how do I test my event handlers? for example, if I have

   (fn [cofx [_ item]]
     {:db ...}))
should I extract this anonymous function from there instead and have
(ref/reg-event-fx :do-something something-handler)
and then simply test something-handler normally?


or is there a re-frame way of testing this?


You can use for testing reframe subscriptions and events

😀 8

@bravilogy The version with extracting the fn and unit testning it is common too


@curlyfry Hi there, I usually try to split my event-handlers for testing but how would I use fn-traced from reframe-10x with it? (sorry...beginner)


There is a defn-traced as well! 🙂


great! thanks!


Hi guys, I was trying . But ctrl-h opens the <chrome://history> for me. I am using ubuntu. Is there a workaround ?


I think there could be another issue here with my setup here main is not being called automatically.


I got the reframe dashboard working. 🏁


I am having dependency issues with Global Interceptors, so if I want to define an interceptor that is run for all event handlers as described in I have to refer to the interceptor in the re-frame namespace. This prevents me from using any re-frame in the interceptor itself (e.g. I can't dispatch events) unless I define the interceptor directly in my re-frame namespace., which is not ideal. Has anyone figured out a way to solve this? I'm leaning towards a global interceptor "registry" like all the other re-frame concepts to solve this issue.


My understanding is that your my-reg-event-db can be put into a project util file (or something along those lines), then you refer to your util file to use it from the rest of your project. re-frame shouldn't need to depend on your file at all.


Ah I see, I unfortunately extended more of re-frame in to the same namespace as the util file, so I don't import both "re-frame.core" and "my-app.utils" everywhere, I just import ""


So this most likely is just a me problem :S


good morning, I want to issue an sql query to mysql via re-frame. I've done this in clojure via jdbc and have read this doc ( but wondering what people normally do for the db connection, i.e. is it done in clojure with jdbc (I've done that many times before) or in clojurescript (never done that before... is there a library I need?) Seeking an example, if possible. Thanks


e.g. how would issue-items-query! connect to mysql (over jdbc? in cljs?)


looks like I'll revert to querying via jdbc on the server via a route then...


@aaelony: You still need a back-end to talk to the database, and then you would communicate with that in a similar way to any other javascript client/server application. I have a REST based service running that I talk to using event handlers (described a bit in and it works pretty well (my eventual goal is to use something like to make things a little more seamless though).


I just need to figure out how the plumbing from clojure to cljs works once the server gets the data then I guess. Thanks @shaun-mahood


Another strange question... If I do lein new re-frame myapp +10x +cider +handler +garden +routes, then do lein repl, get the prompt, then in a separate terminal do lein figwheel dev, when everything connects I get the "Hello from re-frame. This is the Home Page" in red color. However, if instead of the lein repl step, I do lein garden once, then lein figwheel dev, then the "Hello from re-frame. This is the Home Page" is *not in red color*. I'm using Chrome. Is that weird?