Fork me on GitHub

Hi! How do you testing components today? I search a lot and see fews examples dated from 2014-2015. Do you using macros or other approach? How do I do if I want to isolated my components to unit test? Do I need always start my full system?


why would a macro help?


components naturaly isolate - you just pass in alternates for each key they want to use, and it's isolated from the other components


and no, I would never start the whole system in a test, just the component being tested


I saw this link about the macro with-components


Understood. Thanks @noisesmith.


More one question, sorry if I’am inconvenient, but I started to learn Clojure a few months. Is this approach ideal to isolate my component and test the life cycle and public api?


yes, and usually a component needs other components that you would want to associate as keys onto component


but since they will likely be test stubs, you can just directly attach them as keys - you can use map literals to create small one time use components with the values you need in them, component just passes a map on unchanged