Skip to content
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

Testing not working #77

Open
hscrocha opened this issue Sep 9, 2022 · 0 comments
Open

Testing not working #77

hscrocha opened this issue Sep 9, 2022 · 0 comments

Comments

@hscrocha
Copy link

hscrocha commented Sep 9, 2022

I cant seem to get testing to work. I installed the dev dependencies, and I am trying to create a in-memory DB for my test.

First by using the example "const db = new Datastore()" does not work, and the error says options.storage is not defined (even though the readme has no info on whether storage is optional/mandatory). I also tried "const db = new Datastore({inMemoryOnly:true});" same issue.

If I set storage using the AsyncStorage, then the problem changes as AsyncStorage cannot be used in Jest. All docs on testing AsyncStorage tell to mock it. The general mock codes I can find do not seem to work with the react-native-local-mongodb.

How can you set up the test environment to use the Datastore in Jest?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant