Skip to content

Commit c58b2cd

Browse files
committed
fix unit
1 parent 8b56601 commit c58b2cd

File tree

4 files changed

+31
-3
lines changed

4 files changed

+31
-3
lines changed

test/unit/assorted/server_discovery_and_monitoring.spec.test.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,16 @@ describe('Server Discovery and Monitoring (spec)', function () {
214214
.stub(Topology.prototype, 'selectServer')
215215
.callsFake(async function (_selector, _options) {
216216
topologySelectServers.restore();
217-
return fakeServer();
217+
218+
const fakeServer = {
219+
s: { state: 'connected' },
220+
removeListener: () => true,
221+
pool: {
222+
checkOut: async () => ({}),
223+
checkIn: () => undefined
224+
}
225+
};
226+
return fakeServer;
218227
});
219228
});
220229

test/unit/assorted/server_discovery_and_monitoring.test.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,16 @@ describe('Server Discovery and Monitoring', function () {
3131
.stub(Topology.prototype, 'selectServer')
3232
.callsFake(async function (_selector, _options) {
3333
topologySelectServer.restore();
34-
return fakeServer();
34+
35+
const fakeServer = {
36+
s: { state: 'connected' },
37+
removeListener: () => true,
38+
pool: {
39+
checkOut: async () => ({}),
40+
checkIn: () => undefined
41+
}
42+
};
43+
return fakeServer;
3544
});
3645

3746
events = [];

test/unit/assorted/server_selection_spec_helper.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,16 @@ export async function executeServerSelectionTest(testDefinition) {
105105
.stub(Topology.prototype, 'selectServer')
106106
.callsFake(async function () {
107107
topologySelectServers.restore();
108-
return fakeServer();
108+
109+
const fakeServer = {
110+
s: { state: 'connected' },
111+
removeListener: () => true,
112+
pool: {
113+
checkOut: async () => ({}),
114+
checkIn: () => undefined
115+
}
116+
};
117+
return fakeServer;
109118
});
110119

111120
await topology.connect();

test/unit/sdam/topology.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import { Topology } from '../../../src/sdam/topology';
2626
import { TopologyDescription } from '../../../src/sdam/topology_description';
2727
import { TimeoutContext } from '../../../src/timeout';
2828
import { isHello, ns } from '../../../src/utils';
29+
import { ConnectionPool } from '../../mongodb';
2930
import * as mock from '../../tools/mongodb-mock/index';
3031
import { topologyWithPlaceholderClient } from '../../tools/utils';
3132

0 commit comments

Comments
 (0)