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

Function test

test/integration/change-streams/change_stream.test.ts:174–186  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

172 it('should close the listeners after the cursor is closed', {
173 metadata: { requires: { topology: 'replicaset' } },
174 async test() {
175 const collection = db.collection('closesListeners');
176 const changeStream = collection.watch(pipeline);
177 const willBeChanges = on(changeStream, 'change');
178 await once(changeStream.cursor, 'init');
179 await collection.insertOne({ a: 1 });
180
181 await willBeChanges.next();
182 expect(changeStream.cursorStream?.listenerCount('data')).to.equal(1);
183
184 await changeStream.close();
185 expect(changeStream.cursorStream).to.not.exist;
186 }
187 });
188
189 it('contains a wallTime date property on the change', {

Callers

nothing calls this directly

Calls 15

delayFunction · 0.90
onceFunction · 0.85
lastWriteFunction · 0.85
insertOneMethod · 0.80
listenerCountMethod · 0.80
hasNextMethod · 0.80
tryNextMethod · 0.80
matchMethod · 0.80
failMethod · 0.80
dropDatabaseMethod · 0.80
deferMethod · 0.80
insertManyMethod · 0.80

Tested by

no test coverage detected