@@ -181,6 +181,7 @@ test('fromJSON too old schemaVersion', async () => {
181
181
182
182
const go = ( ) => depGraphLib . createFromJSON ( graphJson ) ;
183
183
expect ( go ) . toThrow ( / s c h e m a V e r s i o n / ) ;
184
+ expect ( go ) . toThrow ( depGraphLib . Errors . ValidationError ) ;
184
185
} ) ;
185
186
186
187
test ( 'fromJSON too new schemaVersion' , async ( ) => {
@@ -190,6 +191,7 @@ test('fromJSON too new schemaVersion', async () => {
190
191
191
192
const go = ( ) => depGraphLib . createFromJSON ( graphJson ) ;
192
193
expect ( go ) . toThrow ( / s c h e m a V e r s i o n / ) ;
194
+ expect ( go ) . toThrow ( depGraphLib . Errors . ValidationError ) ;
193
195
} ) ;
194
196
195
197
test ( 'fromJSON missing root' , async ( ) => {
@@ -204,6 +206,7 @@ test('fromJSON missing root', async () => {
204
206
205
207
const go = ( ) => depGraphLib . createFromJSON ( graphJson ) ;
206
208
expect ( go ) . toThrow ( / r o o t / ) ;
209
+ expect ( go ) . toThrow ( depGraphLib . Errors . ValidationError ) ;
207
210
} ) ;
208
211
209
212
test ( 'fromJSON missing pkgManager.name' , async ( ) => {
@@ -213,6 +216,7 @@ test('fromJSON missing pkgManager.name', async () => {
213
216
214
217
const go = ( ) => depGraphLib . createFromJSON ( graphJson ) ;
215
218
expect ( go ) . toThrow ( / p k g M a n a g e r \. n a m e / ) ;
219
+ expect ( go ) . toThrow ( depGraphLib . Errors . ValidationError ) ;
216
220
} ) ;
217
221
218
222
test ( 'fromJSON missing pkgManager' , async ( ) => {
@@ -222,6 +226,7 @@ test('fromJSON missing pkgManager', async () => {
222
226
223
227
const go = ( ) => depGraphLib . createFromJSON ( graphJson ) ;
224
228
expect ( go ) . toThrow ( / p k g M a n a g e r / ) ;
229
+ expect ( go ) . toThrow ( depGraphLib . Errors . ValidationError ) ;
225
230
} ) ;
226
231
227
232
test ( 'fromJSON root pkg id doesnt match name@version' , async ( ) => {
@@ -255,6 +260,7 @@ test('fromJSON root pkg id doesnt match name@version', async () => {
255
260
256
261
const go = ( ) => depGraphLib . createFromJSON ( graphJson ) ;
257
262
expect ( go ) . toThrow ( / n a m e @ v e r s i o n / ) ;
263
+ expect ( go ) . toThrow ( depGraphLib . Errors . ValidationError ) ;
258
264
} ) ;
259
265
260
266
test ( 'fromJSON with a cycle' , async ( ) => {
@@ -359,6 +365,7 @@ test('fromJSON root is not really root', async () => {
359
365
360
366
const go = ( ) => depGraphLib . createFromJSON ( graphJson ) ;
361
367
expect ( go ) . toThrow ( / r o o t / ) ;
368
+ expect ( go ) . toThrow ( depGraphLib . Errors . ValidationError ) ;
362
369
} ) ;
363
370
364
371
test ( 'fromJSON a pkg is not reachable from root' , async ( ) => {
@@ -398,6 +405,7 @@ test('fromJSON a pkg is not reachable from root', async () => {
398
405
399
406
const go = ( ) => depGraphLib . createFromJSON ( graphJson ) ;
400
407
expect ( go ) . toThrow ( / r e a c h / ) ;
408
+ expect ( go ) . toThrow ( depGraphLib . Errors . ValidationError ) ;
401
409
} ) ;
402
410
403
411
test ( 'fromJSON root is not really root' , async ( ) => {
@@ -439,6 +447,7 @@ test('fromJSON root is not really root', async () => {
439
447
440
448
const go = ( ) => depGraphLib . createFromJSON ( graphJson ) ;
441
449
expect ( go ) . toThrow ( / r o o t / ) ;
450
+ expect ( go ) . toThrow ( depGraphLib . Errors . ValidationError ) ;
442
451
} ) ;
443
452
444
453
test ( 'fromJSON a pkg without an instance' , async ( ) => {
@@ -473,6 +482,7 @@ test('fromJSON a pkg without an instance', async () => {
473
482
474
483
const go = ( ) => depGraphLib . createFromJSON ( graphJson ) ;
475
484
expect ( go ) . toThrow ( / i n s t a n c e / ) ;
485
+ expect ( go ) . toThrow ( depGraphLib . Errors . ValidationError ) ;
476
486
} ) ;
477
487
478
488
test ( 'fromJSON an instance without a pkg' , async ( ) => {
@@ -512,6 +522,7 @@ test('fromJSON an instance without a pkg', async () => {
512
522
513
523
const go = ( ) => depGraphLib . createFromJSON ( ( graphJson as any ) as depGraphLib . DepGraphData ) ;
514
524
expect ( go ) . toThrow ( / i n s t a n c e / ) ;
525
+ expect ( go ) . toThrow ( depGraphLib . Errors . ValidationError ) ;
515
526
} ) ;
516
527
517
528
test ( 'fromJSON an instance points to non-existing pkgId' , async ( ) => {
@@ -552,6 +563,7 @@ test('fromJSON an instance points to non-existing pkgId', async () => {
552
563
553
564
const go = ( ) => depGraphLib . createFromJSON ( graphJson ) ;
554
565
expect ( go ) . toThrow ( / e x i s t / ) ;
566
+ expect ( go ) . toThrow ( depGraphLib . Errors . ValidationError ) ;
555
567
} ) ;
556
568
557
569
test ( 'fromJSON root has several instances' , async ( ) => {
@@ -592,6 +604,7 @@ test('fromJSON root has several instances', async () => {
592
604
593
605
const go = ( ) => depGraphLib . createFromJSON ( graphJson ) ;
594
606
expect ( go ) . toThrow ( / r o o t / ) ;
607
+ expect ( go ) . toThrow ( depGraphLib . Errors . ValidationError ) ;
595
608
} ) ;
596
609
597
610
test ( 'fromJSON a pkg missing info field' , async ( ) => {
@@ -626,6 +639,7 @@ test('fromJSON a pkg missing info field', async () => {
626
639
const go = ( ) => depGraphLib . createFromJSON ( ( graphJson as any ) as depGraphLib . DepGraphData ) ;
627
640
expect ( go ) . toThrow ( / \. i n f o / ) ;
628
641
expect ( go ) . toThrow ( / ^ ( (? ! ( o f u n d e f i n e d ) ) .) * $ / ) ;
642
+ expect ( go ) . toThrow ( depGraphLib . Errors . ValidationError ) ;
629
643
} ) ;
630
644
631
645
test ( 'fromJSON a pkg missing name field' , async ( ) => {
@@ -659,6 +673,7 @@ test('fromJSON a pkg missing name field', async () => {
659
673
660
674
const go = ( ) => depGraphLib . createFromJSON ( ( graphJson as any ) as depGraphLib . DepGraphData ) ;
661
675
expect ( go ) . toThrow ( / n a m e / ) ;
676
+ expect ( go ) . toThrow ( depGraphLib . Errors . ValidationError ) ;
662
677
} ) ;
663
678
664
679
test ( 'fromJSON a pkg missing version field' , async ( ) => {
@@ -728,6 +743,7 @@ test('fromJSON pkg-id is not name@version', async () => {
728
743
729
744
const go = ( ) => depGraphLib . createFromJSON ( graphJson ) ;
730
745
expect ( go ) . toThrow ( / n a m e / ) ;
746
+ expect ( go ) . toThrow ( depGraphLib . Errors . ValidationError ) ;
731
747
} ) ;
732
748
733
749
test ( 'fromJSON duplicate node-id' , async ( ) => {
@@ -766,6 +782,7 @@ test('fromJSON duplicate node-id', async () => {
766
782
767
783
const go = ( ) => depGraphLib . createFromJSON ( graphJson ) ;
768
784
expect ( go ) . toThrow ( / n o d e .* s a m e i d / ) ;
785
+ expect ( go ) . toThrow ( depGraphLib . Errors . ValidationError ) ;
769
786
} ) ;
770
787
771
788
test ( 'fromJSON duplicate pkg-id' , async ( ) => {
@@ -800,4 +817,5 @@ test('fromJSON duplicate pkg-id', async () => {
800
817
801
818
const go = ( ) => depGraphLib . createFromJSON ( graphJson ) ;
802
819
expect ( go ) . toThrow ( / p k g .* s a m e i d / ) ;
820
+ expect ( go ) . toThrow ( depGraphLib . Errors . ValidationError ) ;
803
821
} ) ;
0 commit comments