Skip to content

How to setup initial data in the database? #309

@JonesWest

Description

@JonesWest

For a lot of our tests it would be neat (or even necessary) to have some existing data in the database before running the test. One way to populate the database would be to make a general script or function, that could create all the test documents, and call that script before each test case, but I am afraid the script will be messy, and it will be difficult to create all references between documents etc.

Therefore, I am trying to figure out if I can create a complete dump of a sandbox database (maybe a subset of our already existing production database) that I can initialize the mongodb-memory-server with, before each test case?

Is that possible? and is there maybe a better way of doing this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions