(input, output)
| 1654 | }; |
| 1655 | |
| 1656 | const cursorSort = (input, output) => |
| 1657 | async function () { |
| 1658 | const client = this.configuration.newClient({ monitorCommands: true }); |
| 1659 | const events = []; |
| 1660 | client.on('commandStarted', event => { |
| 1661 | if (event.commandName === 'find') { |
| 1662 | events.push(event); |
| 1663 | } |
| 1664 | }); |
| 1665 | const db = client.db('test'); |
| 1666 | const collection = db.collection('test_sort_dos'); |
| 1667 | const cursor = collection.find({}).sort(input); |
| 1668 | await cursor.next(); |
| 1669 | expect(events[0].command.sort).to.be.instanceOf(Map); |
| 1670 | expect(Array.from(events[0].command.sort)).to.deep.equal(Array.from(output)); |
| 1671 | await client.close(); |
| 1672 | }; |
| 1673 | |
| 1674 | it('should use find options object', findSort({ alpha: 1 }, new Map([['alpha', 1]]))); |
| 1675 | it('should use find options string', findSort('alpha', new Map([['alpha', 1]]))); |
no test coverage detected