| 118 | await doc.validate(); |
| 119 | |
| 120 | const assertValidationError = error => { |
| 121 | assert.equal(error?.name, 'ValidationError'); |
| 122 | assert.ok(error.errors['name']); |
| 123 | assert.ok( |
| 124 | error.errors['name'].message.includes('Validator failed for path `name` with value ``'), |
| 125 | error.errors['name'].message |
| 126 | ); |
| 127 | assert.ok(error.errors['age']); |
| 128 | assert.ok( |
| 129 | error.errors['age'].message.includes('Validator failed for path `age` with value `201`'), |
| 130 | error.errors['age'].message |
| 131 | ); |
| 132 | assert.ok(error.errors['subdoc']); |
| 133 | assert.ok( |
| 134 | error.errors['subdoc'].message.includes('Validator failed for path `subdoc` with value `{ url: \'\' }`'), |
| 135 | error.errors['subdoc'].message |
| 136 | ); |
| 137 | assert.ok(error.errors['docArr.0.subprop']); |
| 138 | assert.ok( |
| 139 | error.errors['docArr.0.subprop'].message.includes('Validator failed for path `subprop` with value ``'), |
| 140 | error.errors['docArr.0.subprop'].message |
| 141 | ); |
| 142 | }; |
| 143 | |
| 144 | assertValidationError(doc.validateSync({ validateAllPaths: true })); |
| 145 | assertValidationError(await doc.validate({ validateAllPaths: true }).then(() => null, error => error)); |
no outgoing calls
no test coverage detected