@@ -74,22 +74,26 @@ describe('parseEdges', () => {
7474 } ) ;
7575
7676 it ( 'throws on invalid lengths' , ( ) => {
77- expect ( ( ) => parseEdges ( '' ) ) . toThrowError ( "Expected number or length string, got: ''" ) ;
78- expect ( ( ) => parseEdges ( Infinity ) ) . toThrowError (
79- 'Expected number or length string, got: Infinity' ,
77+ expect ( ( ) => parseEdges ( '' ) ) . toThrow (
78+ new TypeError ( "Expected number or length string, got: ''" ) ,
79+ ) ;
80+ expect ( ( ) => parseEdges ( Infinity ) ) . toThrow (
81+ new TypeError ( 'Expected number or length string, got: Infinity' ) ,
8082 ) ;
8183 } ) ;
8284
8385 it ( 'throws on invalid types' , ( ) => {
84- expect ( ( ) => parseEdges ( '' ) ) . toThrowError ( "Expected number or length string, got: ''" ) ;
85- expect ( ( ) => parseEdges ( null ) ) . toThrowError (
86- 'Expected number, length string, or object, got: null' ,
86+ expect ( ( ) => parseEdges ( '' ) ) . toThrow (
87+ new TypeError ( "Expected number or length string, got: ''" ) ,
88+ ) ;
89+ expect ( ( ) => parseEdges ( null ) ) . toThrow (
90+ new TypeError ( 'Expected number, length string, or object, got: null' ) ,
8791 ) ;
88- expect ( ( ) => parseEdges ( true ) ) . toThrowError (
89- 'Expected number, length string, or object, got: true' ,
92+ expect ( ( ) => parseEdges ( true ) ) . toThrow (
93+ new TypeError ( 'Expected number, length string, or object, got: true' ) ,
9094 ) ;
91- expect ( ( ) => parseEdges ( ( ) => 23 ) ) . toThrowError (
92- 'Expected number, length string, or object, got: anonymous function' ,
95+ expect ( ( ) => parseEdges ( ( ) => 23 ) ) . toThrow (
96+ new TypeError ( 'Expected number, length string, or object, got: anonymous function' ) ,
9397 ) ;
9498 } ) ;
9599} ) ;
@@ -125,23 +129,35 @@ describe('parseLength', () => {
125129 } ) ;
126130
127131 it ( 'throws on invalid strings' , ( ) => {
128- expect ( ( ) => parseLength ( '' ) ) . toThrowError ( "Expected number or length string, got: ''" ) ;
129- expect ( ( ) => parseLength ( '1' ) ) . toThrowError ( "Expected number or length string, got: '1'" ) ;
130- expect ( ( ) => parseLength ( '1xy' ) ) . toThrowError ( "Expected number or length string, got: '1xy'" ) ;
132+ expect ( ( ) => parseLength ( '' ) ) . toThrow (
133+ new TypeError ( "Expected number or length string, got: ''" ) ,
134+ ) ;
135+ expect ( ( ) => parseLength ( '1' ) ) . toThrow (
136+ new TypeError ( "Expected number or length string, got: '1'" ) ,
137+ ) ;
138+ expect ( ( ) => parseLength ( '1xy' ) ) . toThrow (
139+ new TypeError ( "Expected number or length string, got: '1xy'" ) ,
140+ ) ;
131141 } ) ;
132142
133143 it ( 'throws on invalid numbers' , ( ) => {
134- expect ( ( ) => parseLength ( Infinity ) ) . toThrowError (
135- 'Expected number or length string, got: Infinity' ,
144+ expect ( ( ) => parseLength ( Infinity ) ) . toThrow (
145+ new TypeError ( 'Expected number or length string, got: Infinity' ) ,
146+ ) ;
147+ expect ( ( ) => parseLength ( NaN ) ) . toThrow (
148+ new TypeError ( 'Expected number or length string, got: NaN' ) ,
136149 ) ;
137- expect ( ( ) => parseLength ( NaN ) ) . toThrowError ( 'Expected number or length string, got: NaN' ) ;
138150 } ) ;
139151
140152 it ( 'throws on invalid types' , ( ) => {
141- expect ( ( ) => parseLength ( null ) ) . toThrowError ( 'Expected number or length string, got: null' ) ;
142- expect ( ( ) => parseLength ( true ) ) . toThrowError ( 'Expected number or length string, got: true' ) ;
143- expect ( ( ) => parseLength ( ( ) => 23 ) ) . toThrowError (
144- 'Expected number or length string, got: anonymous function' ,
153+ expect ( ( ) => parseLength ( null ) ) . toThrow (
154+ new TypeError ( 'Expected number or length string, got: null' ) ,
155+ ) ;
156+ expect ( ( ) => parseLength ( true ) ) . toThrow (
157+ new TypeError ( 'Expected number or length string, got: true' ) ,
158+ ) ;
159+ expect ( ( ) => parseLength ( ( ) => 23 ) ) . toThrow (
160+ new TypeError ( 'Expected number or length string, got: anonymous function' ) ,
145161 ) ;
146162 } ) ;
147163} ) ;
0 commit comments