diff options
author | Ruben Bridgewater <ruben@bridgewater.de> | 2018-11-18 04:33:46 +0100 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2018-12-05 20:07:14 +0100 |
commit | a7a1cb48f550d4533b4df7dad6a1ae63f5a3ed61 (patch) | |
tree | 6c0c7972c56b4e1c7084afaf845e7f0487c6eab4 | |
parent | 1ec4f8dc3dec84f136393784113a8445b23e26bc (diff) | |
download | node-new-a7a1cb48f550d4533b4df7dad6a1ae63f5a3ed61.tar.gz |
test: check for the correct strict equal arguments order
This activates a eslint rule to verify that the `assert.strictEqual()`
arguments are in the correct order.
PR-URL: https://github.com/nodejs/node/pull/24752
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
-rw-r--r-- | test/.eslintrc.yaml | 5 | ||||
-rw-r--r-- | test/parallel/test-http-blank-header.js | 6 | ||||
-rw-r--r-- | test/parallel/test-process-env.js | 2 |
3 files changed, 6 insertions, 7 deletions
diff --git a/test/.eslintrc.yaml b/test/.eslintrc.yaml index 63d2127d73..12be376357 100644 --- a/test/.eslintrc.yaml +++ b/test/.eslintrc.yaml @@ -48,9 +48,8 @@ rules: message: "The first argument should be the `actual`, not the `expected` value." - selector: "CallExpression[callee.object.name='assert'][callee.property.name='deepStrictEqual'][arguments.0.type='Literal']:not([arguments.1.type='Literal']):not([arguments.1.type='ObjectExpression']):not([arguments.1.type='ArrayExpression'])" message: "The first argument should be the `actual`, not the `expected` value." - # TODO: Activate the `strictEqual` rule as soon as it produces less churn. - # - selector: "CallExpression[callee.object.name='assert'][callee.property.name='strictEqual'][arguments.0.type='Literal']:not([arguments.1.type='Literal']):not([arguments.1.type='ObjectExpression']):not([arguments.1.type='ArrayExpression'])" - # message: "The first argument should be the `actual`, not the `expected` value." + - selector: "CallExpression[callee.object.name='assert'][callee.property.name='strictEqual'][arguments.0.type='Literal']:not([arguments.1.type='Literal']):not([arguments.1.type='ObjectExpression']):not([arguments.1.type='ArrayExpression'])" + message: "The first argument should be the `actual`, not the `expected` value." # Global scoped methods and vars globals: WebAssembly: false diff --git a/test/parallel/test-http-blank-header.js b/test/parallel/test-http-blank-header.js index 3f2b512fc8..fd447b46d2 100644 --- a/test/parallel/test-http-blank-header.js +++ b/test/parallel/test-http-blank-header.js @@ -28,11 +28,11 @@ const net = require('net'); const server = http.createServer(common.mustCall((req, res) => { assert.strictEqual(req.method, 'GET'); assert.strictEqual(req.url, '/blah'); - assert.deepStrictEqual({ + assert.deepStrictEqual(req.headers, { host: 'example.org:443', origin: 'http://example.org', cookie: '' - }, req.headers); + }); })); @@ -52,7 +52,7 @@ server.listen(0, common.mustCall(() => { received += data.toString(); })); c.on('end', common.mustCall(() => { - assert.strictEqual('HTTP/1.1 400 Bad Request\r\n\r\n', received); + assert.strictEqual(received, 'HTTP/1.1 400 Bad Request\r\n\r\n'); c.end(); })); c.on('close', common.mustCall(() => server.close())); diff --git a/test/parallel/test-process-env.js b/test/parallel/test-process-env.js index 51cc637d06..81651efbea 100644 --- a/test/parallel/test-process-env.js +++ b/test/parallel/test-process-env.js @@ -68,7 +68,7 @@ if (process.argv[2] === 'you-are-the-child') { // delete should return true except for non-configurable properties // https://github.com/nodejs/node/issues/7960 delete process.env.NON_EXISTING_VARIABLE; -assert.strictEqual(true, delete process.env.NON_EXISTING_VARIABLE); +assert(delete process.env.NON_EXISTING_VARIABLE); /* For the moment we are not going to support setting the timezone via the * environment variables. The problem is that various V8 platform backends |