MCPcopy Create free account
hub / github.com/Automattic/mongoose / assertInvalidateError

Function assertInvalidateError

test/document.validate.test.js:1671–1679  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1669 const invalidate = () => post.invalidate('baz',
1670 'validation failed for path {PATH}', 'val', 'custom error');
1671 const assertInvalidateError = err => {
1672 assert.ok(err instanceof MongooseError);
1673 assert.ok(err instanceof ValidationError);
1674 assert.ok(err.errors.baz instanceof ValidatorError);
1675 assert.equal(err.errors.baz.message, 'validation failed for path baz');
1676 assert.equal(err.errors.baz.path, 'baz');
1677 assert.equal(err.errors.baz.value, 'val');
1678 assert.equal(err.errors.baz.kind, 'custom error');
1679 };
1680
1681 // `invalidate()` returns the error it recorded, and each validation run
1682 // consumes it, so re-invalidate before checking the next entry point.

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected