| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent e2f5648 commit 591a692
1 file changed
| 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); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments