- Goal: Have tests to ensure that every high priority field is mandatory, and its not possible to create a document without providing them. making those fields avoid null/undefined typing.
Tips on how to solve/should be solved
test("Name field should be required on crate model", async () => {
const crate = new Crate();
await expect(crate.save()).rejects.toThrowError(
/^Crate validation failed: name: Path `name` is required., id: Path `id` is required.$/
);
});
});
To do
- Check if every high priority field has the
required: true prop on it schema.
- Write test for each one of them.
Tips on how to solve/should be solved
To do
required: trueprop on it schema.