Wondering how folks are testing apps that use compojure-api + datomic. Currently: have middleware that adds datomic and conn and db to the request; using datomock and clojure.core/with-redefs
in tests to simulate using [1] as guide. Does this sound reasonable or is there a better way to do it? ([1]: http://vvvvalvalval.github.io/posts/2016-07-24-datomic-web-app-a-practical-guide.html#forking_database_connections). Thanks!
@csm Doing something similar with mount/start-with
, but only the connection is passed in. Is the component system started for each request, or on "server start" (e.g ring init handler)
only on server start, and we do that in use-fixtures :each
, so itโs a new DB and new server for each test
@csm ah. I want to obtain a new DB value on each request, so passing in on server start not an option :thinking_face:
We wrote a testing library that spins up a datomic DB using mem
storage, and then starts the service (via com.stuartsierra.component
) with the temp DB passed into the system. We do this for each test with use-fixtures
, initializing the schema and test data each run.