There appear to be a number of issues present with the User model tests.
Regarding the point of .expect usage, it's probably worth looking into any other REST unit tests to make sure they are correct in implementation.
A question in general. There is both vanilla assert statements and chai expect statements, which is the preferred approach for testing?
Additional tests to add
There appear to be a number of issues present with the User model tests.
invalidCredentialsare actually valid (seevalidCredentialsEmailVerified)invalidCredentialsshould actually fail but it doesn't (broader problem, see below).expectneeds to be paired with logic in the.endcallback (eg.if (err) return done(err);) when testing REST calls, this is not applied to all instances. to confirm these are failing, change one of the.expectvalues and note the test still passesinvalidCredentialsand nothing specific for API callRegarding the point of
.expectusage, it's probably worth looking into any other REST unit tests to make sure they are correct in implementation.A question in general. There is both vanilla
assertstatements and chaiexpectstatements, which is the preferred approach for testing?Additional tests to add