File tree Expand file tree Collapse file tree 1 file changed +12
-15
lines changed
shelly/plotlyjs/static/plotlyjs/tests Expand file tree Collapse file tree 1 file changed +12
-15
lines changed Original file line number Diff line number Diff line change @@ -204,17 +204,15 @@ describe('extendFlat', function() {
204
204
} ) ;
205
205
206
206
it ( 'does not handle null inputs' , function ( ) {
207
- try { extendFlat ( null , obj ) ; }
208
- catch ( err ) {
209
- expect ( err . toString ( ) . indexOf ( 'TypeError:' ) !== 1 ) . toBe ( true ) ;
210
- }
207
+ expect ( function ( ) {
208
+ extendFlat ( null , obj ) ;
209
+ } ) . toThrowError ( TypeError ) ;
211
210
} ) ;
212
211
213
212
it ( 'does not handle string targets' , function ( ) {
214
- try { extendFlat ( 'str' , obj ) ; }
215
- catch ( err ) {
216
- expect ( err . toString ( ) . indexOf ( 'TypeError:' ) !== 1 ) . toBe ( true ) ;
217
- }
213
+ expect ( function ( ) {
214
+ extendFlat ( null , obj ) ;
215
+ } ) . toThrowError ( TypeError ) ;
218
216
} ) ;
219
217
} ) ;
220
218
@@ -398,13 +396,12 @@ describe('extendDeep', function() {
398
396
var circ = { a : { b : null } } ;
399
397
circ . a . b = circ ;
400
398
401
- try { extendDeep ( { } , circ ) ; }
402
- catch ( err ) {
403
- expect (
404
- err . toString ( ) . indexOf ( 'InternalError:' ) !== 1 || // firefox
405
- err . toString ( ) . indexOf ( 'RangeError:' ) !== 1 // chrome
406
- ) . toBe ( true ) ;
407
- }
399
+ expect ( function ( ) {
400
+ extendDeep ( { } , circ ) ;
401
+ } ) . toThrow ( ) ;
402
+
403
+ // results in an InternalError on Chrome and
404
+ // a RangeError on Firefox
408
405
} ) ;
409
406
} ) ;
410
407
You can’t perform that action at this time.
0 commit comments