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 da57213

Browse filesBrowse files
edsadrItalo A. Casas
authored andcommitted
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: #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>
1 parent 17d9a73 commit da57213
Copy full SHA for da57213

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

+7
-7
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-process-hrtime.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-process-hrtime.js
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ require('../common');
33
var assert = require('assert');
44

55
// the default behavior, return an Array "tuple" of numbers
6-
var tuple = process.hrtime();
6+
const tuple = process.hrtime();
77

88
// validate the default behavior
99
validateTuple(tuple);
@@ -12,16 +12,16 @@ validateTuple(tuple);
1212
validateTuple(process.hrtime(tuple));
1313

1414
// test that only an Array may be passed to process.hrtime()
15-
assert.throws(function() {
15+
assert.throws(() => {
1616
process.hrtime(1);
17-
});
17+
}, /^TypeError: process.hrtime\(\) only accepts an Array tuple$/);
1818

1919
function validateTuple(tuple) {
2020
assert(Array.isArray(tuple));
21-
assert.equal(2, tuple.length);
22-
tuple.forEach(function(v) {
23-
assert.equal('number', typeof v);
24-
assert(isFinite(v));
21+
assert.strictEqual(tuple.length, 2);
22+
tuple.forEach((v) => {
23+
assert.strictEqual(typeof v, 'number');
24+
assert.strictEqual(isFinite(v), true);
2525
});
2626
}
2727

0 commit comments

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