Fork me on GitHub
#mount
<
2017-11-23
>
rod13:11:59

Hi - anyone know if I can start just one component with a particular state?

jmayaalv14:11:39

@rod do u mean a mount state?. u could swap a state with another one of u prefer using mount/swap. there r other alternatives depending on what you want to do.

rod14:11:24

thanks @jmayaalv - my situation is for a unit test i want to mock my app.config/config state, but i don't want to start the entire system to do it (i think i could use start-with or swap but i'd then need to specify all of my states to disable (like database connections and other services). so i really just want to say (mount/start {#app/config {:some "config}}) and have only that state started. does that make sense?

rod14:11:05

like... (mount/start-only ...) i guess would fit?

rod14:11:46

oh wait, can i do that with... (-> (only #{app/config x}) (start)) I'll try...

rod14:11:50

yes!

(-> (only #{#'app.config/config})
    (swap {#'app.config/config {:some "config"}))
    (start))