(Model, value)
| 2277 | describe('`castNonArrays` on nested arrays', function() { |
| 2278 | // Returns the path of the single CastError that `value` causes on `matrix` |
| 2279 | async function getCastErrorPath(Model, value) { |
| 2280 | const err = await new Model({ matrix: value }).validate().then(() => null, err => err); |
| 2281 | assert.ok(err, `expected ${JSON.stringify(value)} to fail casting`); |
| 2282 | const paths = Object.keys(err.errors); |
| 2283 | assert.equal(paths.length, 1); |
| 2284 | assert.equal(err.errors[paths[0]].name, 'CastError'); |
| 2285 | return paths[0]; |
| 2286 | } |
| 2287 | |
| 2288 | async function castMatrix(Model, value) { |
| 2289 | const doc = new Model({ matrix: value }); |
no test coverage detected