@@ -144,15 +144,15 @@ const EXTRA_EXPECTED = { type: 'string', title: 'foo' };
144144
145145describe ( 'findSchemaDefinition()' , ( ) => {
146146 it ( 'throws error when ref is missing' , ( ) => {
147- expect ( ( ) => findSchemaDefinition ( ) ) . toThrowError ( 'Could not find a definition for undefined' ) ;
147+ expect ( ( ) => findSchemaDefinition ( ) ) . toThrow ( 'Could not find a definition for undefined' ) ;
148148 } ) ;
149149 it ( 'throws error when ref is malformed' , ( ) => {
150- expect ( ( ) => findSchemaDefinition ( 'definitions/missing' ) ) . toThrowError (
150+ expect ( ( ) => findSchemaDefinition ( 'definitions/missing' ) ) . toThrow (
151151 'Could not find a definition for definitions/missing' ,
152152 ) ;
153153 } ) ;
154154 it ( 'throws error when ref does not exist' , ( ) => {
155- expect ( ( ) => findSchemaDefinition ( '#/definitions/missing' , schema ) ) . toThrowError (
155+ expect ( ( ) => findSchemaDefinition ( '#/definitions/missing' , schema ) ) . toThrow (
156156 'Could not find a definition for #/definitions/missing' ,
157157 ) ;
158158 } ) ;
@@ -166,22 +166,22 @@ describe('findSchemaDefinition()', () => {
166166 expect ( findSchemaDefinition ( '#/definitions/extraNestedRef' , schema ) ) . toEqual ( EXTRA_EXPECTED ) ;
167167 } ) ;
168168 it ( 'throws error when ref is a circular reference' , ( ) => {
169- expect ( ( ) => findSchemaDefinition ( '#/definitions/badCircularNestedRef' , schema ) ) . toThrowError (
169+ expect ( ( ) => findSchemaDefinition ( '#/definitions/badCircularNestedRef' , schema ) ) . toThrow (
170170 'Definition for #/definitions/badCircularNestedRef is a circular reference' ,
171171 ) ;
172172 } ) ;
173173 it ( 'throws error when ref is a deep circular reference' , ( ) => {
174- expect ( ( ) => findSchemaDefinition ( '#/definitions/badCircularDeepNestedRef' , schema ) ) . toThrowError (
174+ expect ( ( ) => findSchemaDefinition ( '#/definitions/badCircularDeepNestedRef' , schema ) ) . toThrow (
175175 'Definition for #/definitions/badCircularDeepNestedRef contains a circular reference through #/definitions/badCircularDeeperNestedRef -> #/definitions/badCircularDeepestNestedRef -> #/definitions/badCircularDeepNestedRef' ,
176176 ) ;
177177 } ) ;
178178 it ( 'throws error when bundled ref are not part of JSON Schema Draft 2020-12' , ( ) => {
179- expect ( ( ) => findSchemaDefinition ( '#/definitions/bundledRef' , schema ) ) . toThrowError (
179+ expect ( ( ) => findSchemaDefinition ( '#/definitions/bundledRef' , schema ) ) . toThrow (
180180 'Could not find a definition for /bundled.ref.json' ,
181181 ) ;
182182 } ) ;
183183 it ( 'throws error when bundled ref with explicit baseURI are not part of JSON Schema Draft 2020-12' , ( ) => {
184- expect ( ( ) => findSchemaDefinition ( '#/properties/num' , schema , 'https://example.com/bundled.ref.json' ) ) . toThrowError (
184+ expect ( ( ) => findSchemaDefinition ( '#/properties/num' , schema , 'https://example.com/bundled.ref.json' ) ) . toThrow (
185185 'Could not find a definition for #/properties/num' ,
186186 ) ;
187187 } ) ;
@@ -224,43 +224,43 @@ describe('findSchemaDefinition()', () => {
224224 ) ;
225225 } ) ;
226226 it ( 'throws error when relative ref is undefined in a bundled JSON Schema' , ( ) => {
227- expect ( ( ) => findSchemaDefinition ( '#/$defs/undefinedRef' , bundledSchema ) ) . toThrowError (
227+ expect ( ( ) => findSchemaDefinition ( '#/$defs/undefinedRef' , bundledSchema ) ) . toThrow (
228228 'Could not find a definition for /undefined.ref.json' ,
229229 ) ;
230230 } ) ;
231231 it ( 'throws error when relative ref with anchor is undefined in a bundled JSON Schema' , ( ) => {
232- expect ( ( ) => findSchemaDefinition ( '#/$defs/undefinedRefWithAnchor' , bundledSchema ) ) . toThrowError (
232+ expect ( ( ) => findSchemaDefinition ( '#/$defs/undefinedRefWithAnchor' , bundledSchema ) ) . toThrow (
233233 'Could not find a definition for #/$defs/undefined' ,
234234 ) ;
235235 } ) ;
236236 it ( 'throws error when local ref is undefined in a bundled JSON Schema with explicit base URI' , ( ) => {
237237 expect ( ( ) =>
238238 findSchemaDefinition ( '#/properties/undefined' , bundledSchema , 'https://example.com/bundled.ref.json' ) ,
239- ) . toThrowError ( 'Could not find a definition for #/properties/undefined' ) ;
239+ ) . toThrow ( 'Could not find a definition for #/properties/undefined' ) ;
240240 } ) ;
241241 it ( 'throws error when explicit base URI is undefined in a bundled JSON Schema' , ( ) => {
242242 expect ( ( ) =>
243243 findSchemaDefinition ( '#/properties/undefined' , bundledSchema , 'https://example.com/undefined.ref.json' ) ,
244- ) . toThrowError ( 'Could not find a definition for #/properties/undefined' ) ;
244+ ) . toThrow ( 'Could not find a definition for #/properties/undefined' ) ;
245245 } ) ;
246246 it ( 'throws error when ref is a deep circular reference in a bundled JSON Schema' , ( ) => {
247- expect ( ( ) => findSchemaDefinition ( '#/$defs/circularRef' , bundledSchema ) ) . toThrowError (
247+ expect ( ( ) => findSchemaDefinition ( '#/$defs/circularRef' , bundledSchema ) ) . toThrow (
248248 'Definition for #/$defs/circularRef contains a circular reference through /bundled.ref.json/#/$defs/circularRef -> /bundled.schema.json/#/$defs/circularRef -> #/$defs/circularRef' ,
249249 ) ;
250250 } ) ;
251251} ) ;
252252
253253describe ( 'findSchemaDefinitionRecursive()' , ( ) => {
254254 it ( 'throws error when ref is missing' , ( ) => {
255- expect ( ( ) => findSchemaDefinitionRecursive ( ) ) . toThrowError ( 'Could not find a definition for undefined' ) ;
255+ expect ( ( ) => findSchemaDefinitionRecursive ( ) ) . toThrow ( 'Could not find a definition for undefined' ) ;
256256 } ) ;
257257 it ( 'throws error when ref is malformed' , ( ) => {
258- expect ( ( ) => findSchemaDefinitionRecursive ( 'definitions/missing' ) ) . toThrowError (
258+ expect ( ( ) => findSchemaDefinitionRecursive ( 'definitions/missing' ) ) . toThrow (
259259 'Could not find a definition for definitions/missing' ,
260260 ) ;
261261 } ) ;
262262 it ( 'throws error when ref does not exist' , ( ) => {
263- expect ( ( ) => findSchemaDefinitionRecursive ( '#/definitions/missing' , schema ) ) . toThrowError (
263+ expect ( ( ) => findSchemaDefinitionRecursive ( '#/definitions/missing' , schema ) ) . toThrow (
264264 'Could not find a definition for #/definitions/missing' ,
265265 ) ;
266266 } ) ;
@@ -274,24 +274,24 @@ describe('findSchemaDefinitionRecursive()', () => {
274274 expect ( findSchemaDefinitionRecursive ( '#/definitions/extraNestedRef' , schema ) ) . toEqual ( EXTRA_EXPECTED ) ;
275275 } ) ;
276276 it ( 'throws error when ref is a circular reference' , ( ) => {
277- expect ( ( ) => findSchemaDefinitionRecursive ( '#/definitions/badCircularNestedRef' , schema ) ) . toThrowError (
277+ expect ( ( ) => findSchemaDefinitionRecursive ( '#/definitions/badCircularNestedRef' , schema ) ) . toThrow (
278278 'Definition for #/definitions/badCircularNestedRef is a circular reference' ,
279279 ) ;
280280 } ) ;
281281 it ( 'throws error when ref is a deep circular reference' , ( ) => {
282- expect ( ( ) => findSchemaDefinitionRecursive ( '#/definitions/badCircularDeepNestedRef' , schema ) ) . toThrowError (
282+ expect ( ( ) => findSchemaDefinitionRecursive ( '#/definitions/badCircularDeepNestedRef' , schema ) ) . toThrow (
283283 'Definition for #/definitions/badCircularDeepNestedRef contains a circular reference through #/definitions/badCircularDeeperNestedRef -> #/definitions/badCircularDeepestNestedRef -> #/definitions/badCircularDeepNestedRef' ,
284284 ) ;
285285 } ) ;
286286 it ( 'throws error when bundled ref are not part of JSON Schema Draft 2020-12' , ( ) => {
287- expect ( ( ) => findSchemaDefinitionRecursive ( '#/definitions/bundledRef' , schema ) ) . toThrowError (
287+ expect ( ( ) => findSchemaDefinitionRecursive ( '#/definitions/bundledRef' , schema ) ) . toThrow (
288288 'Could not find a definition for /bundled.ref.json' ,
289289 ) ;
290290 } ) ;
291291 it ( 'throws error when bundled ref with explicit baseURI are not part of JSON Schema Draft 2020-12' , ( ) => {
292292 expect ( ( ) =>
293293 findSchemaDefinitionRecursive ( '#/properties/num' , schema , [ ] , 'https://example.com/bundled.ref.json' ) ,
294- ) . toThrowError ( 'Could not find a definition for #/properties/num' ) ;
294+ ) . toThrow ( 'Could not find a definition for #/properties/num' ) ;
295295 } ) ;
296296 it ( 'correctly resolves absolute bundled refs within a JSON Schema Draft 2020-12' , ( ) => {
297297 expect ( findSchemaDefinitionRecursive ( '#/$defs/bundledAbsoluteRef' , bundledSchema ) ) . toStrictEqual ( internalSchema ) ;
@@ -334,12 +334,12 @@ describe('findSchemaDefinitionRecursive()', () => {
334334 ) . toBe ( internalSchema . properties ! . num ) ;
335335 } ) ;
336336 it ( 'throws error when relative ref is undefined in a bundled JSON Schema' , ( ) => {
337- expect ( ( ) => findSchemaDefinitionRecursive ( '#/$defs/undefinedRef' , bundledSchema ) ) . toThrowError (
337+ expect ( ( ) => findSchemaDefinitionRecursive ( '#/$defs/undefinedRef' , bundledSchema ) ) . toThrow (
338338 'Could not find a definition for /undefined.ref.json' ,
339339 ) ;
340340 } ) ;
341341 it ( 'throws error when relative ref with anchor is undefined in a bundled JSON Schema' , ( ) => {
342- expect ( ( ) => findSchemaDefinitionRecursive ( '#/$defs/undefinedRefWithAnchor' , bundledSchema ) ) . toThrowError (
342+ expect ( ( ) => findSchemaDefinitionRecursive ( '#/$defs/undefinedRefWithAnchor' , bundledSchema ) ) . toThrow (
343343 'Could not find a definition for #/$defs/undefined' ,
344344 ) ;
345345 } ) ;
@@ -351,15 +351,15 @@ describe('findSchemaDefinitionRecursive()', () => {
351351 [ ] ,
352352 'https://example.com/bundled.ref.json' ,
353353 ) ,
354- ) . toThrowError ( 'Could not find a definition for #/properties/undefined' ) ;
354+ ) . toThrow ( 'Could not find a definition for #/properties/undefined' ) ;
355355 } ) ;
356356 it ( 'throws error when explicit base URI is undefined in a bundled JSON Schema' , ( ) => {
357357 expect ( ( ) =>
358358 findSchemaDefinition ( '#/properties/undefined' , bundledSchema , 'https://example.com/undefined.ref.json' ) ,
359- ) . toThrowError ( 'Could not find a definition for #/properties/undefined' ) ;
359+ ) . toThrow ( 'Could not find a definition for #/properties/undefined' ) ;
360360 } ) ;
361361 it ( 'throws error when ref is a deep circular reference in a bundled JSON Schema' , ( ) => {
362- expect ( ( ) => findSchemaDefinitionRecursive ( '#/$defs/circularRef' , bundledSchema , [ ] ) ) . toThrowError (
362+ expect ( ( ) => findSchemaDefinitionRecursive ( '#/$defs/circularRef' , bundledSchema , [ ] ) ) . toThrow (
363363 'Definition for #/$defs/circularRef contains a circular reference through /bundled.ref.json/#/$defs/circularRef -> /bundled.schema.json/#/$defs/circularRef -> #/$defs/circularRef' ,
364364 ) ;
365365 } ) ;
0 commit comments