Skip to content

Commit

Permalink
test: use common.mustNotMutate() in immutability tests
Browse files Browse the repository at this point in the history
  • Loading branch information
LiviaMedeiros committed May 29, 2022
1 parent 510ae57 commit 7c41890
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion test/parallel/test-fs-options-immutable.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const common = require('../common');
const fs = require('fs');
const path = require('path');

const options = Object.freeze({});
const options = common.mustNotMutate({});
const tmpdir = require('../common/tmpdir');
tmpdir.refresh();

Expand Down
9 changes: 3 additions & 6 deletions test/parallel/test-https-agent-create-connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,19 +139,16 @@ function createServer() {
server.listen(0, common.mustCall(() => {
const port = server.address().port;
const host = 'localhost';
const options = {
const options = common.mustNotMutate({
port: 3000,
rejectUnauthorized: false
};
rejectUnauthorized: false,
});

const socket = agent.createConnection(port, host, options);
socket.on('connect', common.mustCall((data) => {
socket.end();
}));
socket.on('end', common.mustCall(() => {
assert.deepStrictEqual(options, {
port: 3000, rejectUnauthorized: false
});
server.close();
}));
}));
Expand Down
6 changes: 4 additions & 2 deletions test/parallel/test-https-argument-of-creating.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ const dftProtocol = {};

// Test for immutable `opts`
{
const opts = { foo: 'bar', ALPNProtocols: [ 'http/1.1' ] };
const opts = common.mustNotMutate({
foo: 'bar',
ALPNProtocols: [ 'http/1.1' ],
});
const server = https.createServer(opts);

tls.convertALPNProtocols([ 'http/1.1' ], dftProtocol);
assert.deepStrictEqual(opts, { foo: 'bar', ALPNProtocols: [ 'http/1.1' ] });
assert.strictEqual(server.ALPNProtocols.compare(dftProtocol.ALPNProtocols),
0);
}
Expand Down

0 comments on commit 7c41890

Please sign in to comment.