In the implementation of repositories, you inject the PersistenceManager
interface using @InjectPersistenceManager()
. For testing, the docs mention to use RunWithDrivine
, and to import Drivine (through the AppModule
) into the createTestingModule
call. This allows the PersistenceManager
to be injected in the repository to be used.
I create a temporary Docker container with a new Neo4j database for the tests to use (using a package called testcontainers
). This database needs some data to be used. In the test setup, it is possible to get the PersistenceManager
by retrieving it from the testing module using a string which normally the decorator provides: app.get("PersistenceManager:default") as PersistenceManager
and while this works, it does not seem like the correct way to do it.
How would I get the PersistenceManager
to set up the data (and do other things) properly?