summaryrefslogtreecommitdiff
path: root/test/parallel/test-fs-open-flags.js
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2017-06-20 23:20:10 +0200
committerRefael Ackermann <refack@gmail.com>2017-07-22 18:18:04 -0400
commit095357e26efc366b1cca389306e0780cc1fa81d9 (patch)
tree428cb86546dca71248b43a318d9afd15b508d9c4 /test/parallel/test-fs-open-flags.js
parent8979b4fc9face199099a53f32dfeb14a1203ad57 (diff)
downloadandroid-node-v8-095357e26efc366b1cca389306e0780cc1fa81d9.tar.gz
android-node-v8-095357e26efc366b1cca389306e0780cc1fa81d9.tar.bz2
android-node-v8-095357e26efc366b1cca389306e0780cc1fa81d9.zip
lib: tweak use of internal/errors
In addition refactor common.throws to common.expectsError PR-URL: https://github.com/nodejs/node/pull/13829 Refs: https://github.com/nodejs/node/issues/11273 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'test/parallel/test-fs-open-flags.js')
-rw-r--r--test/parallel/test-fs-open-flags.js19
1 files changed, 8 insertions, 11 deletions
diff --git a/test/parallel/test-fs-open-flags.js b/test/parallel/test-fs-open-flags.js
index 8f68b407df..873bd71128 100644
--- a/test/parallel/test-fs-open-flags.js
+++ b/test/parallel/test-fs-open-flags.js
@@ -55,29 +55,26 @@ assert.strictEqual(stringToFlags('xa'), O_APPEND | O_CREAT | O_WRONLY | O_EXCL);
assert.strictEqual(stringToFlags('ax+'), O_APPEND | O_CREAT | O_RDWR | O_EXCL);
assert.strictEqual(stringToFlags('xa+'), O_APPEND | O_CREAT | O_RDWR | O_EXCL);
-const expectedError =
- common.expectsError({ code: 'ERR_INVALID_OPT_VALUE', type: TypeError }, 23);
-
('+ +a +r +w rw wa war raw r++ a++ w++ x +x x+ rx rx+ wxx wax xwx xxx')
.split(' ')
.forEach(function(flags) {
- assert.throws(
+ common.expectsError(
() => stringToFlags(flags),
- expectedError
+ { code: 'ERR_INVALID_OPT_VALUE', type: TypeError }
);
});
-assert.throws(
+common.expectsError(
() => stringToFlags({}),
- expectedError
+ { code: 'ERR_INVALID_OPT_VALUE', type: TypeError }
);
-assert.throws(
+common.expectsError(
() => stringToFlags(true),
- expectedError
+ { code: 'ERR_INVALID_OPT_VALUE', type: TypeError }
);
-assert.throws(
+common.expectsError(
() => stringToFlags(null),
- expectedError
+ { code: 'ERR_INVALID_OPT_VALUE', type: TypeError }
);