VRMS icon indicating copy to clipboard operation
VRMS copied to clipboard

Epic: Create true unit tests for backend models

Open dannyprikaz opened this issue 7 months ago • 0 comments

Overview

Current tests for modules in /backend/models/ are failing intermittently because the depend on a faulty configuration of MongoMemoryServer. We need to create unit tests that isolate the the behavior of these models that we define and/or don't interact with an actual Mongo server.

Methods that ought to be tested and how:

We are defining the methods.serialize method on all of our schemas, and should test that the models exhibit the correct behavior when serialized. We are also depending on the validation functionality of models (like in user.model.js when we define a schema where accessLevel has the enum property. We should make sure that models are only valid when they are supposed to be.

Action Items

  • [x] #1951

Resources/Instructions

https://jestjs.io/docs/getting-started https://mongoosejs.com/docs/models.html

dannyprikaz avatar Jun 02 '25 01:06 dannyprikaz