Skip to content

Commit

Permalink
test: fix arguments order in assertions
Browse files Browse the repository at this point in the history
Have the actual value first & the expected value second.

PR-URL: #24149
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
  • Loading branch information
herschel666 authored and codebytere committed Jan 12, 2019
1 parent d4fd76a commit b29b235
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions test/parallel/test-process-env.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ const assert = require('assert');

// changes in environment should be visible to child processes
if (process.argv[2] === 'you-are-the-child') {
assert.strictEqual(false, 'NODE_PROCESS_ENV_DELETED' in process.env);
assert.strictEqual('42', process.env.NODE_PROCESS_ENV);
assert.strictEqual('asdf', process.env.hasOwnProperty);
assert.strictEqual('NODE_PROCESS_ENV_DELETED' in process.env, false);
assert.strictEqual(process.env.NODE_PROCESS_ENV, '42');
assert.strictEqual(process.env.hasOwnProperty, 'asdf');
const hasOwnProperty = Object.prototype.hasOwnProperty;
const has = hasOwnProperty.call(process.env, 'hasOwnProperty');
assert.strictEqual(true, has);
assert.strictEqual(has, true);
process.exit(0);
}

Expand All @@ -41,18 +41,18 @@ if (process.argv[2] === 'you-are-the-child') {
assert.strictEqual(Object.prototype.hasOwnProperty,
process.env.hasOwnProperty);
const has = process.env.hasOwnProperty('hasOwnProperty');
assert.strictEqual(false, has);
assert.strictEqual(has, false);

process.env.hasOwnProperty = 'asdf';

process.env.NODE_PROCESS_ENV = 42;
assert.strictEqual('42', process.env.NODE_PROCESS_ENV);
assert.strictEqual(process.env.NODE_PROCESS_ENV, '42');

process.env.NODE_PROCESS_ENV_DELETED = 42;
assert.strictEqual(true, 'NODE_PROCESS_ENV_DELETED' in process.env);
assert.strictEqual('NODE_PROCESS_ENV_DELETED' in process.env, true);

delete process.env.NODE_PROCESS_ENV_DELETED;
assert.strictEqual(false, 'NODE_PROCESS_ENV_DELETED' in process.env);
assert.strictEqual('NODE_PROCESS_ENV_DELETED' in process.env, false);

const child = spawn(process.argv[0], [process.argv[1], 'you-are-the-child']);
child.stdout.on('data', function(data) { console.log(data.toString()); });
Expand Down

0 comments on commit b29b235

Please sign in to comment.