Skip to content

Commit 867f7b7

Browse files
committedFeb 27, 2024·
test: fix #13335 tests
1 parent a9f6614 commit 867f7b7

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed
 

‎test/connection.test.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -1542,7 +1542,12 @@ describe('connections:', function() {
15421542
it('should not throw an error when attempting to mutate unmutable options object gh-13335', async function() {
15431543
const m = new mongoose.Mongoose();
15441544
const opts = Object.preventExtensions({});
1545-
const conn = await m.connect('mongodb://127.0.0.1:27017/db?retryWrites=true&w=majority&readPreference=primaryPreferred', opts);
1545+
1546+
const uri = start.uri.lastIndexOf('?') === -1 ?
1547+
start.uri + '?retryWrites=true&w=majority&readPreference=primaryPreferred' :
1548+
start.uri.slice(0, start.uri.lastIndexOf('?')) + '?retryWrites=true&w=majority&readPreference=primaryPreferred';
1549+
1550+
const conn = await m.connect(uri, opts);
15461551
assert.ok(conn);
15471552
});
15481553
});

0 commit comments

Comments
 (0)
Please sign in to comment.