Skip to content

Commit

Permalink
test: fix #13335 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Feb 27, 2024
1 parent a9f6614 commit 867f7b7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test/connection.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1542,7 +1542,12 @@ describe('connections:', function() {
it('should not throw an error when attempting to mutate unmutable options object gh-13335', async function() {
const m = new mongoose.Mongoose();
const opts = Object.preventExtensions({});
const conn = await m.connect('mongodb://127.0.0.1:27017/db?retryWrites=true&w=majority&readPreference=primaryPreferred', opts);

const uri = start.uri.lastIndexOf('?') === -1 ?
start.uri + '?retryWrites=true&w=majority&readPreference=primaryPreferred' :
start.uri.slice(0, start.uri.lastIndexOf('?')) + '?retryWrites=true&w=majority&readPreference=primaryPreferred';

Check failure on line 1549 in test/connection.test.js

View workflow job for this annotation

GitHub Actions / Lint JS-Files

Trailing spaces not allowed

Check failure on line 1549 in test/connection.test.js

View workflow job for this annotation

GitHub Actions / Lint JS-Files

Trailing spaces not allowed
const conn = await m.connect(uri, opts);
assert.ok(conn);
});
});
Expand Down

0 comments on commit 867f7b7

Please sign in to comment.