(defaultSort = { value: -1 })
| 21 | afterEach(() => require('./util').stopRemainingOps(db)); |
| 22 | |
| 23 | async function createModel(defaultSort = { value: -1 }) { |
| 24 | const Test = db.model('Test', new Schema({ name: String, value: Number }, { defaultSort })); |
| 25 | await Test.insertMany([ |
| 26 | { name: 'a', value: 1 }, |
| 27 | { name: 'b', value: 3 }, |
| 28 | { name: 'c', value: 2 } |
| 29 | ]); |
| 30 | return Test; |
| 31 | } |
| 32 | |
| 33 | it('throws on invalid `defaultSort` values when creating the schema', function() { |
| 34 | assert.throws(() => new Schema({}, { defaultSort: 42 }), /`defaultSort` must be falsy, string, object, array, or Map, got `number`/); |
no test coverage detected