(config)
| 108 | |
| 109 | context('#bulkWrite', () => { |
| 110 | async function testBulkWrite(config) { |
| 111 | const client = new MongoClient(`mongodb://${server.uri()}/test`); |
| 112 | |
| 113 | server.setMessageHandler(request => { |
| 114 | const doc = request.document; |
| 115 | if (doc.insert) { |
| 116 | expect(doc.bypassDocumentValidation).equal(config.expected); |
| 117 | request.reply({ |
| 118 | ok: 1 |
| 119 | }); |
| 120 | } |
| 121 | |
| 122 | if (isHello(doc)) { |
| 123 | request.reply(Object.assign({}, HELLO)); |
| 124 | } else if (doc.endSessions) { |
| 125 | request.reply({ ok: 1 }); |
| 126 | } |
| 127 | }); |
| 128 | |
| 129 | await client.connect(); |
| 130 | const db = client.db('test'); |
| 131 | const collection = db.collection('test_c'); |
| 132 | |
| 133 | const options = { |
| 134 | bypassDocumentValidation: config.actual, |
| 135 | ordered: config.ordered |
| 136 | }; |
| 137 | |
| 138 | await collection.bulkWrite([{ insertOne: { document: { a: 1 } } }], options); |
| 139 | await client.close(); |
| 140 | } |
| 141 | |
| 142 | // ordered bulk write, testing change in ordered.js |
| 143 | it('should only set bypass document validation if strictly true in ordered bulkWrite', async function () { |
no test coverage detected