summaryrefslogtreecommitdiff
path: root/test/parallel/test-zlib-deflate-constructors.js
diff options
context:
space:
mode:
authorJames M Snell <jasnell@gmail.com>2017-02-14 17:58:15 -0800
committerJames M Snell <jasnell@gmail.com>2017-02-17 10:37:46 -0800
commitb514bd231ed8926a0037b78e85d267a602c2e7cd (patch)
tree9a73b57ca3453f813e92e377b32650d4bd83d5ee /test/parallel/test-zlib-deflate-constructors.js
parent8e69f7e38552a4c65064f2829d9ca973ad9b05ba (diff)
downloadandroid-node-v8-b514bd231ed8926a0037b78e85d267a602c2e7cd.tar.gz
android-node-v8-b514bd231ed8926a0037b78e85d267a602c2e7cd.tar.bz2
android-node-v8-b514bd231ed8926a0037b78e85d267a602c2e7cd.zip
zlib: use RangeError/TypeError consistently
PR-URL: https://github.com/nodejs/node/pull/11391 Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Diffstat (limited to 'test/parallel/test-zlib-deflate-constructors.js')
-rw-r--r--test/parallel/test-zlib-deflate-constructors.js20
1 files changed, 10 insertions, 10 deletions
diff --git a/test/parallel/test-zlib-deflate-constructors.js b/test/parallel/test-zlib-deflate-constructors.js
index 3aef067162..ca9c4f801b 100644
--- a/test/parallel/test-zlib-deflate-constructors.js
+++ b/test/parallel/test-zlib-deflate-constructors.js
@@ -15,7 +15,7 @@ assert.ok(new zlib.DeflateRaw() instanceof zlib.DeflateRaw);
// Throws if `opts.chunkSize` is invalid
assert.throws(
() => { new zlib.Deflate({chunkSize: -Infinity}); },
- /^Error: Invalid chunk size: -Infinity$/
+ /^RangeError: Invalid chunk size: -Infinity$/
);
// Confirm that maximum chunk size cannot be exceeded because it is `Infinity`.
@@ -24,23 +24,23 @@ assert.strictEqual(zlib.constants.Z_MAX_CHUNK, Infinity);
// Throws if `opts.windowBits` is invalid
assert.throws(
() => { new zlib.Deflate({windowBits: -Infinity}); },
- /^Error: Invalid windowBits: -Infinity$/
+ /^RangeError: Invalid windowBits: -Infinity$/
);
assert.throws(
() => { new zlib.Deflate({windowBits: Infinity}); },
- /^Error: Invalid windowBits: Infinity$/
+ /^RangeError: Invalid windowBits: Infinity$/
);
// Throws if `opts.level` is invalid
assert.throws(
() => { new zlib.Deflate({level: -Infinity}); },
- /^Error: Invalid compression level: -Infinity$/
+ /^RangeError: Invalid compression level: -Infinity$/
);
assert.throws(
() => { new zlib.Deflate({level: Infinity}); },
- /^Error: Invalid compression level: Infinity$/
+ /^RangeError: Invalid compression level: Infinity$/
);
// Throws a RangeError if `level` invalid in `Deflate.prototype.params()`
@@ -57,12 +57,12 @@ assert.throws(
// Throws if `opts.memLevel` is invalid
assert.throws(
() => { new zlib.Deflate({memLevel: -Infinity}); },
- /^Error: Invalid memLevel: -Infinity$/
+ /^RangeError: Invalid memLevel: -Infinity$/
);
assert.throws(
() => { new zlib.Deflate({memLevel: Infinity}); },
- /^Error: Invalid memLevel: Infinity$/
+ /^RangeError: Invalid memLevel: Infinity$/
);
// Does not throw if opts.strategy is valid
@@ -89,13 +89,13 @@ assert.doesNotThrow(
// Throws if opt.strategy is the wrong type.
assert.throws(
() => { new zlib.Deflate({strategy: '' + zlib.constants.Z_RLE }); },
- /^Error: Invalid strategy: 3$/
+ /^TypeError: Invalid strategy: 3$/
);
// Throws if opts.strategy is invalid
assert.throws(
() => { new zlib.Deflate({strategy: 'this is a bogus strategy'}); },
- /^Error: Invalid strategy: this is a bogus strategy$/
+ /^TypeError: Invalid strategy: this is a bogus strategy$/
);
// Throws TypeError if `strategy` is invalid in `Deflate.prototype.params()`
@@ -107,5 +107,5 @@ assert.throws(
// Throws if opts.dictionary is not a Buffer
assert.throws(
() => { new zlib.Deflate({dictionary: 'not a buffer'}); },
- /^Error: Invalid dictionary: it should be a Buffer instance$/
+ /^TypeError: Invalid dictionary: it should be a Buffer instance$/
);