-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using a different database for tests #138
Comments
Can't you use a different .env file for testing? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm trying to make use of an in-memory database (mongodb-memory-server) when running my tests, but I can't get it to work. I think that the fact that I'm requiring "loaders" when I create a server instance in the tests creates a mongoose connection with the actual database (
mongoose.ts
is one of the loaders). So I'm unable to connect with the test database.I've gone through the "test-related" issues on this repo, and all of them seemed to make use of mocks, but I don't want to do that.
I'd appreciate any suggestions on how to resolve this---how to essentially, given this project structure, make use of a test database such as mongodb-memory-server.
Here's what my
db-manager
looks like - it houses the methods required to create the test DB.Also, here is what my test looks like
UPDATE: A few mins later
What I do now, which seems to work, is to
I'm hoping there's a much neater way to go about it. Furthermore, I'm not sure if this approach is consequence-free as the instance I had to disconnect from is what was passed to the
dependencyInjectorLoader
, and subsequently, theagendaInstance
as seen in the repo's source code.The text was updated successfully, but these errors were encountered: