Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 776cc3a

Browse filesBrowse files
LiviaMedeirosdanielleadams
authored andcommitted
test: use common.mustNotMutateObjectDeep() in immutability tests
PR-URL: #43196 Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 42f2deb commit 776cc3a
Copy full SHA for 776cc3a

File tree

Expand file treeCollapse file tree

3 files changed

+8
-9
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+8
-9
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-fs-options-immutable.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-fs-options-immutable.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const common = require('../common');
99
const fs = require('fs');
1010
const path = require('path');
1111

12-
const options = Object.freeze({});
12+
const options = common.mustNotMutateObjectDeep({});
1313
const tmpdir = require('../common/tmpdir');
1414
tmpdir.refresh();
1515

Collapse file

‎test/parallel/test-https-agent-create-connection.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-https-agent-create-connection.js
+3-6Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,19 +139,16 @@ function createServer() {
139139
server.listen(0, common.mustCall(() => {
140140
const port = server.address().port;
141141
const host = 'localhost';
142-
const options = {
142+
const options = common.mustNotMutateObjectDeep({
143143
port: 3000,
144-
rejectUnauthorized: false
145-
};
144+
rejectUnauthorized: false,
145+
});
146146

147147
const socket = agent.createConnection(port, host, options);
148148
socket.on('connect', common.mustCall((data) => {
149149
socket.end();
150150
}));
151151
socket.on('end', common.mustCall(() => {
152-
assert.deepStrictEqual(options, {
153-
port: 3000, rejectUnauthorized: false
154-
});
155152
server.close();
156153
}));
157154
}));
Collapse file

‎test/parallel/test-https-argument-of-creating.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-https-argument-of-creating.js
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ const dftProtocol = {};
1212

1313
// Test for immutable `opts`
1414
{
15-
const opts = { foo: 'bar', ALPNProtocols: [ 'http/1.1' ] };
15+
const opts = common.mustNotMutateObjectDeep({
16+
foo: 'bar',
17+
ALPNProtocols: [ 'http/1.1' ],
18+
});
1619
const server = https.createServer(opts);
1720

1821
tls.convertALPNProtocols([ 'http/1.1' ], dftProtocol);
19-
assert.deepStrictEqual(opts, { foo: 'bar', ALPNProtocols: [ 'http/1.1' ] });
2022
assert.strictEqual(server.ALPNProtocols.compare(dftProtocol.ALPNProtocols),
2123
0);
2224
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.