File tree 1 file changed +8
-6
lines changed
1 file changed +8
-6
lines 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
- / ^ T y p e E r r o r : C a n n o t c o n v e r t o b j e c t t o p r i m i t i v e v a l u e $ / ) ;
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
- / ^ T y p e E r r o r : C a n n o t c o n v e r t a S y m b o l v a l u e t o a s t r i n g $ / ) ;
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 ) ;
You can’t perform that action at this time.
0 commit comments