Fork me on GitHub

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]: Thanks!


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.


@U1WMPA45U 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


@U1WMPA45U ah. I want to obtain a new DB value on each request, so passing in on server start not an option :thinking_face: