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

Function finished

test/integration/crud/misc_cursors.test.ts:98–124  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

96 }
97
98 async function finished() {
99 let count = await collection.find().count();
100 test.equal(10, count);
101 test.ok(count.constructor === Number);
102
103 count = await collection.find({}, { limit: 5 }).count();
104 test.equal(5, count);
105
106 count = await collection.find({}, { skip: 5 }).count();
107 test.equal(5, count);
108
109 count = await db.collection('acollectionthatdoesn').count();
110
111 test.equal(0, count);
112
113 const cursor = collection.find();
114 count = await cursor.count();
115 test.equal(10, count);
116
117 await cursor.forEach(() => {
118 // do nothing
119 });
120
121 const count2 = await cursor.count();
122 expect(count2).to.equal(10);
123 expect(count2).to.equal(count);
124 }
125
126 await insert();
127 await finished();

Callers 3

testFunction · 0.85
crud_api.test.tsFile · 0.85

Calls 7

toArrayMethod · 0.80
collectionMethod · 0.65
countMethod · 0.45
findMethod · 0.45
okMethod · 0.45
limitMethod · 0.45
skipMethod · 0.45

Tested by

no test coverage detected