@@ -491,7 +491,6 @@ func TestResolveTypeOnInterfaceYieldsUsefulError(t *testing.T) {
491
491
}
492
492
}`
493
493
494
- originalError := gqlerrors .NewFormattedError (`Runtime Object type "Human" is not a possible type for "Pet".` )
495
494
expected := & graphql.Result {
496
495
Data : map [string ]interface {}{
497
496
"pets" : []interface {}{
@@ -506,31 +505,28 @@ func TestResolveTypeOnInterfaceYieldsUsefulError(t *testing.T) {
506
505
nil ,
507
506
},
508
507
},
509
- Errors : []gqlerrors.FormattedError {gqlerrors .FormatError (gqlerrors.Error {
510
- Message : originalError .Message ,
511
- Locations : []location.SourceLocation {
512
- {
513
- Line : 2 ,
514
- Column : 7 ,
508
+ Errors : []gqlerrors.FormattedError {
509
+ {
510
+ Message : `Runtime Object type "Human" is not a possible type for "Pet".` ,
511
+ Locations : []location.SourceLocation {
512
+ {
513
+ Line : 2 ,
514
+ Column : 7 ,
515
+ },
516
+ },
517
+ Path : []interface {}{
518
+ "pets" ,
519
+ 2 ,
515
520
},
516
521
},
517
- Path : []interface {}{
518
- "pets" ,
519
- 2 ,
520
- },
521
- OriginalError : originalError ,
522
- })},
522
+ },
523
523
}
524
524
525
525
result := graphql .Do (graphql.Params {
526
526
Schema : schema ,
527
527
RequestString : query ,
528
528
})
529
-
530
- if len (result .Errors ) == 0 {
531
- t .Fatalf ("wrong result, expected errors: %v, got: %v" , len (expected .Errors ), len (result .Errors ))
532
- }
533
- if ! reflect .DeepEqual (expected , result ) {
529
+ if ! testutil .EqualResults (expected , result ) {
534
530
t .Fatalf ("Unexpected result, Diff: %v" , testutil .Diff (expected , result ))
535
531
}
536
532
}
@@ -619,7 +615,6 @@ func TestResolveTypeOnUnionYieldsUsefulError(t *testing.T) {
619
615
}
620
616
}`
621
617
622
- originalError := gqlerrors .NewFormattedError (`Runtime Object type "Human" is not a possible type for "Pet".` )
623
618
expected := & graphql.Result {
624
619
Data : map [string ]interface {}{
625
620
"pets" : []interface {}{
@@ -635,8 +630,8 @@ func TestResolveTypeOnUnionYieldsUsefulError(t *testing.T) {
635
630
},
636
631
},
637
632
Errors : []gqlerrors.FormattedError {
638
- gqlerrors . FormatError (gqlerrors. Error {
639
- Message : originalError . Message ,
633
+ {
634
+ Message : `Runtime Object type "Human" is not a possible type for "Pet".` ,
640
635
Locations : []location.SourceLocation {
641
636
{
642
637
Line : 2 ,
@@ -647,19 +642,15 @@ func TestResolveTypeOnUnionYieldsUsefulError(t *testing.T) {
647
642
"pets" ,
648
643
2 ,
649
644
},
650
- OriginalError : originalError ,
651
- }),
645
+ },
652
646
},
653
647
}
654
648
655
649
result := graphql .Do (graphql.Params {
656
650
Schema : schema ,
657
651
RequestString : query ,
658
652
})
659
- if len (result .Errors ) == 0 {
660
- t .Fatalf ("wrong result, expected errors: %v, got: %v" , len (expected .Errors ), len (result .Errors ))
661
- }
662
- if ! reflect .DeepEqual (expected , result ) {
653
+ if ! testutil .EqualResults (expected , result ) {
663
654
t .Fatalf ("Unexpected result, Diff: %v" , testutil .Diff (expected , result ))
664
655
}
665
656
}
0 commit comments