hello how do people replace keys in the system-map during tests? for instance there is system-map with
{::config {}
::db {:config (ig/ref ::config)}}
how would you replace config with test config?You could use merge, or the meta-merge package to replace keys before ig/init
I assume I also should change all ig/ref to use different keyword?
You shouldn't have to do that, as long as the contents of those keys change before ig/init
You don’t have to. If you want separate behaviour, you can use two different keys that derive from the same parent.
e.g. prod-config and test-config might derive from config
and I should not require ::prod-config namespace, otherwise wrong init-key might be used?
No, the method is chosen based on the key name. So a init-key for ::prod-config will only work for ::prod-config.
{::test-config {}
::db {:config (ig/ref ::config)}}
will do what I expect?
(assuming (derive test-config config)Ambiguous key:
Maybe I am doing something wrong…You have to make sure that only one of ::test-config and ::prod-config is in your config map.
Otherwise (ig/ref ::config) doesn’t know which one you mean.
oh, found the issue works, thank you!
assuming you need a different ig/init-key method.
@vemv has joined the channel