Could I get some guidance on testing with integrant? I received some advice before:
You can create a test system in a fixture or in a test. Since the config is a plain map, you can easily create sub-systems and systems with mocks.
but I don't understand it. I'm trying to get it to work now, but in the end I only understand how to access components through other components or through integrant.repl, neither which is mentioned (and I get that they're not the right things here).
Trying to get this to work:
(deftest test-system-online?
;;This test should just test the database connection, aka :foo.core/src.
[]
(ig/init
;;Make sure environment is set to dev
(assoc-in core/config
[:foo.core/src :environment]
"dev")
;;What happens now? I can access the datasource using system.repl but that makes me a bad boy.
))The integrant.core/init function returns the system.
(let [system (ig/init dev-config)]
(try ;; test
(finally (ig/halt! system))))
Oh, that was extremely easy 😅 Thank you, this got the job done!