Skip to content

Commit e0d4c2d

Browse files
fix lint and regenerate evergreen configuration
1 parent c4d1963 commit e0d4c2d

File tree

2 files changed

+57
-11
lines changed

2 files changed

+57
-11
lines changed

.evergreen/config.yml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1860,17 +1860,6 @@ tasks:
18601860
- {key: NODE_LTS_VERSION, value: '22'}
18611861
- func: install dependencies
18621862
- func: run lint checks
1863-
- name: run-resource-management-async-dispose
1864-
tags:
1865-
- resource-management
1866-
commands:
1867-
- command: expansions.update
1868-
type: setup
1869-
params:
1870-
updates:
1871-
- {key: NODE_LTS_VERSION, value: '22'}
1872-
- func: install dependencies
1873-
- func: check resource management
18741863
- name: test-explicit-resource-management-feature-integration
18751864
tags:
18761865
- resource-management
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import { expect } from 'chai';
2+
import * as sinon from 'sinon';
3+
4+
import { type MongoClient } from '../../../src';
5+
6+
describe('Symbol.asyncDispose implementation tests', function () {
7+
let client: MongoClient;
8+
9+
afterEach(async function () {
10+
await client?.close();
11+
});
12+
13+
describe('Symbol.asyncDispose defined', function () {
14+
describe('MongoClient', function () {
15+
it('the Symbol.asyncDispose method calls close()', async function () {
16+
client = this.configuration.newClient();
17+
18+
const spy = sinon.spy(client, 'close');
19+
await client[Symbol.asyncDispose]();
20+
expect(spy.called).to.be.true;
21+
});
22+
});
23+
24+
describe('ClientSession', function () {
25+
it('the Symbol.asyncDispose method calls endSession()', async function () {
26+
client = this.configuration.newClient();
27+
const session = client.startSession();
28+
29+
const spy = sinon.spy(session, 'endSession');
30+
await session[Symbol.asyncDispose]();
31+
expect(spy.called).to.be.true;
32+
});
33+
});
34+
35+
describe('ChangeStreams', function () {
36+
it('the Symbol.asyncDispose method calls close()', async function () {
37+
client = this.configuration.newClient();
38+
const changeStream = client.watch();
39+
40+
const spy = sinon.spy(changeStream, 'close');
41+
await changeStream[Symbol.asyncDispose]();
42+
expect(spy.called).to.be.true;
43+
});
44+
});
45+
46+
describe('cursors', function () {
47+
it('the Symbol.asyncDispose method calls close()', async function () {
48+
client = this.configuration.newClient();
49+
const cursor = client.db('foo').collection('bar').find();
50+
51+
const spy = sinon.spy(cursor, 'close');
52+
await cursor[Symbol.asyncDispose]();
53+
expect(spy.called).to.be.true;
54+
});
55+
});
56+
});
57+
});

0 commit comments

Comments
 (0)