Skip to content

Testing not working #77

@hscrocha

Description

@hscrocha

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions