Skip to content

Commit e08bd1a

Browse files
fix leak
1 parent 79b632f commit e08bd1a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

test/unit/api.test.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ describe('wrapper API', () => {
2626
collection = new mongodbLegacy.Collection(db, 'pets', {});
2727
namespace = MongoDBNamespace.fromString('animals.pets');
2828

29-
client.connect().catch(_e => {});
29+
client.connect().catch(_e => { });
3030

3131
instance = makeInstance(
3232
{
@@ -40,6 +40,8 @@ describe('wrapper API', () => {
4040
});
4141

4242
afterEach(async function () {
43+
sinon.restore();
44+
4345
if (className === 'ClientSession' && method !== 'endSession') {
4446
await instance.endSession();
4547
}
@@ -49,7 +51,7 @@ describe('wrapper API', () => {
4951
if (className === 'GridFSBucketWriteStream' && method !== 'end') {
5052
await instance.end();
5153
}
52-
54+
await client.close();
5355
sinon.restore();
5456
});
5557
const resolveSuite = [];
@@ -219,7 +221,7 @@ function makeInstance({ client, db, namespace, collection }, className) {
219221
'GridFSBucketWriteStream',
220222
() => {
221223
const stream = new mongodbLegacy.GridFSBucket(db).openUploadStream('file');
222-
stream.on('error', () => {});
224+
stream.on('error', () => { });
223225
return stream;
224226
}
225227
],

0 commit comments

Comments
 (0)