summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2017-10-17 16:25:33 -0700
committerJames M Snell <jasnell@gmail.com>2017-11-11 17:40:51 -0800
commit0efb6db3900b0240ba585f9593a81142edee2c6d (patch)
treeb9ff2309945d8e0a60ef508b2fba92479b9e736e /test
parent809da849f2fb84bdc96c4381ed1ee7f58c33f6a2 (diff)
downloadandroid-node-v8-0efb6db3900b0240ba585f9593a81142edee2c6d.tar.gz
android-node-v8-0efb6db3900b0240ba585f9593a81142edee2c6d.tar.bz2
android-node-v8-0efb6db3900b0240ba585f9593a81142edee2c6d.zip
test: make test-querystring-escape engine agnostic
Do not check the error message if it is generated by the JavaScript engine (V8, ChakraCore, etc.). Do confirm that it is a `TypeError`. PR-URL: https://github.com/nodejs/node/pull/16272 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Diffstat (limited to 'test')
-rw-r--r--test/parallel/test-querystring-escape.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/test/parallel/test-querystring-escape.js b/test/parallel/test-querystring-escape.js
index 18bece1ab1..25a800a09a 100644
--- a/test/parallel/test-querystring-escape.js
+++ b/test/parallel/test-querystring-escape.js
@@ -28,12 +28,14 @@ assert.strictEqual(
'test'
);
-// toString is not callable, must throw an error
-assert.throws(() => qs.escape({ toString: 5 }),
- /^TypeError: Cannot convert object to primitive value$/);
+// `toString` is not callable, must throw an error.
+// Error message will vary between different JavaScript engines, so only check
+// that it is a `TypeError`.
+assert.throws(() => qs.escape({ toString: 5 }), TypeError);
-// should use valueOf instead of non-callable toString
+// Should use valueOf instead of non-callable toString.
assert.strictEqual(qs.escape({ toString: 5, valueOf: () => 'test' }), 'test');
-assert.throws(() => qs.escape(Symbol('test')),
- /^TypeError: Cannot convert a Symbol value to a string$/);
+// Error message will vary between different JavaScript engines, so only check
+// that it is a `TypeError`.
+assert.throws(() => qs.escape(Symbol('test')), TypeError);