MCPcopy
hub / github.com/mongodb/node-mongodb-native / commitQuorumTest

Function commitQuorumTest

test/integration/index_management.test.ts:761–782  ·  test/integration/index_management.test.ts::commitQuorumTest
(
      testCommand: (db: Db, collection: Collection) => Promise<unknown>
    )

Source from the content-addressed store, hash-verified

759 );
760
761 function commitQuorumTest(
762 testCommand: (db: Db, collection: Collection) => Promise<unknown>
763 ): any {
764 return {
765 metadata: { requires: { mongodb: class="st">'>=4.4', topology: [class="st">'replicaset', class="st">'sharded'] } },
766 test: async function () {
767 const events: CommandStartedEvent[] = [];
768 client.on(class="st">'commandStarted', event => {
769 if (event.commandName === class="st">'createIndexes') events.push(event);
770 });
771
772 const db = client.db(class="st">'test');
773 const collection = db.collection(class="st">'commitQuorum');
774 await collection.insertOne({ a: 1 });
775 await testCommand(db, collection);
776
777 expect(events).to.be.an(class="st">'array').with.lengthOf(1);
778 expect(events[0]).nested.property(class="st">'command.commitQuorum').to.equal(0);
779 await collection.drop();
780 }
781 };
782 }
783 it(
784 class="st">'should run command with commitQuorum if specified on db.createIndex',
785 commitQuorumTest(

Callers 1

Calls 6

onMethod · 0.80
insertOneMethod · 0.80
collectionMethod · 0.65
pushMethod · 0.45
dbMethod · 0.45
dropMethod · 0.45

Tested by

no test coverage detected