GeezerVison is showing github.com — test: make test-querystring-escape engine agnostic · nodejs/node@591a692
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: test/parallel/test-querystring-escape.js +8-6Lines changed: 8 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -28,12 +28,14 @@ assert.strictEqual( |
28 | 28 | 'test' |
29 | 29 | ); |
30 | 30 |
|
31 | | -// toString is not callable, must throw an error |
32 | | -assert.throws(() => qs.escape({ toString: 5 }), |
33 | | - /^TypeError: Cannot convert object to primitive value$/); |
| 31 | +// `toString` is not callable, must throw an error. |
| 32 | +// Error message will vary between different JavaScript engines, so only check |
| 33 | +// that it is a `TypeError`. |
| 34 | +assert.throws(() => qs.escape({ toString: 5 }), TypeError); |
34 | 35 |
|
35 | | -// should use valueOf instead of non-callable toString |
| 36 | +// Should use valueOf instead of non-callable toString. |
36 | 37 | assert.strictEqual(qs.escape({ toString: 5, valueOf: () => 'test' }), 'test'); |
37 | 38 |
|
38 | | -assert.throws(() => qs.escape(Symbol('test')), |
39 | | - /^TypeError: Cannot convert a Symbol value to a string$/); |
| 39 | +// Error message will vary between different JavaScript engines, so only check |
| 40 | +// that it is a `TypeError`. |
| 41 | +assert.throws(() => qs.escape(Symbol('test')), TypeError); |