SJammy
1/3/2020 - 2:34 PM

MODEL TESTING PATTERNS

MODEL TESTING PATTERNS
Review
You have developed a model using TDD!

The model layer represents entities and interactions in a web app’s problem domain.
Model paths can be test-driven using validators. Call validateSync and make assertions on the properties of [instance].errors.[path].
The storage of data can be tested with construction and updating methods like save and update. Retrieval can be tested with query methods like find, findOne, and findby.
Static methods are stored in [schema].statics and instance methods are stored in [schema].methods. Both can be tested like any other JavaScript function.