diff options
author | himself65 <himself65@outlook.com> | 2021-05-13 16:56:50 +0300 |
---|---|---|
committer | himself65 <himself65@outlook.com> | 2021-05-28 12:28:28 +0300 |
commit | 8b09629e23d6f14d5dce40eae7ebaa46d180d6f8 (patch) | |
tree | 0c68cb7a69da1b7027727111738c2ccb5a465b59 /test | |
parent | a4ea9fc48e68716149e17357eb078b9eefeda420 (diff) |
test: simplify test-path-resolve.js
PR-URL: https://github.com/nodejs/node/pull/38671
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/parallel/test-path-resolve.js | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/test/parallel/test-path-resolve.js b/test/parallel/test-path-resolve.js index 77eafd543aa..3fc9b2e3abd 100644 --- a/test/parallel/test-path-resolve.js +++ b/test/parallel/test-path-resolve.js @@ -46,10 +46,9 @@ const resolveTests = [ ], ], ]; -resolveTests.forEach((test) => { - const resolve = test[0]; - test[1].forEach((test) => { - const actual = resolve.apply(null, test[0]); +resolveTests.forEach(([resolve, tests]) => { + tests.forEach(([test, expected]) => { + const actual = resolve.apply(null, test); let actualAlt; const os = resolve === path.win32.resolve ? 'win32' : 'posix'; if (resolve === path.win32.resolve && !common.isWindows) @@ -57,15 +56,14 @@ resolveTests.forEach((test) => { else if (resolve !== path.win32.resolve && common.isWindows) actualAlt = actual.replace(slashRE, '\\'); - const expected = test[1]; const message = - `path.${os}.resolve(${test[0].map(JSON.stringify).join(',')})\n expect=${ + `path.${os}.resolve(${test.map(JSON.stringify).join(',')})\n expect=${ JSON.stringify(expected)}\n actual=${JSON.stringify(actual)}`; if (actual !== expected && actualAlt !== expected) - failures.push(`\n${message}`); + failures.push(message); }); }); -assert.strictEqual(failures.length, 0, failures.join('')); +assert.strictEqual(failures.length, 0, failures.join('\n')); if (common.isWindows) { // Test resolving the current Windows drive letter from a spawned process. |