diff options
author | Adrian Estrada <edsadr@gmail.com> | 2017-01-08 18:41:26 -0500 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2017-01-09 23:50:57 -0800 |
commit | 2685464e34731d9ea14e97616309f4e7b7292551 (patch) | |
tree | 237b2e0bc78353efd2364eab788af2a1d01c5696 /test/parallel/test-process-hrtime.js | |
parent | c9b52aad0aeac5f1484a06bdb33e50b61a52dc34 (diff) | |
download | android-node-v8-2685464e34731d9ea14e97616309f4e7b7292551.tar.gz android-node-v8-2685464e34731d9ea14e97616309f4e7b7292551.tar.bz2 android-node-v8-2685464e34731d9ea14e97616309f4e7b7292551.zip |
test: improve the code in test-process-hrtime
* use const instead of var
* use assert.strictEqual instead of assert.equal and plain assert
* use arrow functions
* swap assertions arguments to match the standard
* validate the error for assert.throws
PR-URL: https://github.com/nodejs/node/pull/10667
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michal Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Diffstat (limited to 'test/parallel/test-process-hrtime.js')
-rw-r--r-- | test/parallel/test-process-hrtime.js | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/test/parallel/test-process-hrtime.js b/test/parallel/test-process-hrtime.js index 1b5940823a..faa598d0a5 100644 --- a/test/parallel/test-process-hrtime.js +++ b/test/parallel/test-process-hrtime.js @@ -3,7 +3,7 @@ require('../common'); const assert = require('assert'); // the default behavior, return an Array "tuple" of numbers -var tuple = process.hrtime(); +const tuple = process.hrtime(); // validate the default behavior validateTuple(tuple); @@ -12,16 +12,16 @@ validateTuple(tuple); validateTuple(process.hrtime(tuple)); // test that only an Array may be passed to process.hrtime() -assert.throws(function() { +assert.throws(() => { process.hrtime(1); -}); +}, /^TypeError: process.hrtime\(\) only accepts an Array tuple$/); function validateTuple(tuple) { assert(Array.isArray(tuple)); - assert.equal(2, tuple.length); - tuple.forEach(function(v) { - assert.equal('number', typeof v); - assert(isFinite(v)); + assert.strictEqual(tuple.length, 2); + tuple.forEach((v) => { + assert.strictEqual(typeof v, 'number'); + assert.strictEqual(isFinite(v), true); }); } |