This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-12-25
Channels
- # adventofcode (16)
- # babashka (8)
- # beginners (13)
- # calva (22)
- # clj-on-windows (20)
- # clojure (49)
- # clojure-australia (1)
- # clojure-europe (6)
- # clojure-nl (2)
- # clojure-uk (3)
- # clojurescript (4)
- # emacs (1)
- # fulcro (20)
- # introduce-yourself (2)
- # java (2)
- # missionary (2)
- # off-topic (10)
- # other-languages (2)
- # pathom (4)
- # re-frame (15)
Happy holiday! Really happy that I finally got time to test out Pathom! I've made a couple of resolvers and got the basics to work. Now I wonder how to reason about resolvers and actions (side effecting stuff). I would like to unit test my resolvers and have come up with this. I assoc a function to each resolver map and that function will be used inside the resolver to return data. In production this functions may do a database or http request. But in the test suite it returns static (or generated) data. Is this a good way to do this? Are there dangerous things I missed?
you can call your resolver like regular functions, so the same concepts apply for testing.
That means you have consider the trade off in calling the "side effect" the reason people tend to mock it is because there is to high a cost. But thats a guideline not a rule.