hackforla / hackforla/VRMS

Epic: Create true unit tests for backend models

Open
#1,950 0 comments 0 reactions 0 assignees View on GitHub
complexity: medium Epic/Overview feature: Infrastructure role: Back End size: Epic
Dominant language
JavaScript
Stars
61
Forks
101
PR merge metrics
No merged PRs in 30d

Description

### 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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.