Skip to content

Commit 960cfe6

Browse files
committed
test: add test for no wire version provided
1 parent 9e05730 commit 960cfe6

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test/unit/sdam/server_selection.test.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,5 +90,22 @@ describe('ServerSelector', function () {
9090
});
9191
});
9292
});
93+
94+
context('when a common wire version is not provided', function () {
95+
const topologyDescription = new TopologyDescription(
96+
TopologyType.ReplicaSetWithPrimary,
97+
serverDescriptions,
98+
'test',
99+
MIN_SECONDARY_WRITE_WIRE_VERSION,
100+
new ObjectId(),
101+
MIN_SECONDARY_WRITE_WIRE_VERSION
102+
);
103+
const selector = secondaryWritableServerSelector();
104+
const server = selector(topologyDescription, Array.from(serverDescriptions.values()));
105+
106+
it('selects a primary', function () {
107+
expect(server).to.deep.equal([primary]);
108+
});
109+
});
93110
});
94111
});

0 commit comments

Comments
 (0)