| 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. |
no outgoing calls
no test coverage detected