Mockgoose is used in tests to intercept all Mongoose calls are persist them to an in-memory database.
However, this is still unnecessarily slow, particularly if records need to be added to the database at the start of every test.
Instead, we could stub the Mongoose calls directly, which gives us more control over how to handle resetting the database (or indeed using a constant object and only tracking the changes in the tests).
https://github.com/weare2brothers/overcooked-api/ is one example of how that could work
Mockgoose is used in tests to intercept all Mongoose calls are persist them to an in-memory database.
However, this is still unnecessarily slow, particularly if records need to be added to the database at the start of every test.
Instead, we could stub the Mongoose calls directly, which gives us more control over how to handle resetting the database (or indeed using a constant object and only tracking the changes in the tests).
https://github.com/weare2brothers/overcooked-api/ is one example of how that could work