Skip to content

Commit

Permalink
Update testing.go
Browse files Browse the repository at this point in the history
check for errors before expected response
  • Loading branch information
fadi-alkatut authored Nov 13, 2018
1 parent 995849d commit 050454c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions gqltesting/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ func RunTest(t *testing.T, test *Test) {
test.Context = context.Background()
}
result := test.Schema.Exec(test.Context, test.Query, test.OperationName, test.Variables)

checkErrors(t, test.ExpectedErrors, result.Errors)

// Verify JSON to avoid red herring errors.
got, err := formatJSON(result.Data)
if err != nil {
Expand All @@ -53,8 +56,6 @@ func RunTest(t *testing.T, test *Test) {
t.Fatalf("want: invalid JSON: %s", err)
}

checkErrors(t, test.ExpectedErrors, result.Errors)

if !bytes.Equal(got, want) {
t.Logf("got: %s", got)
t.Logf("want: %s", want)
Expand Down

0 comments on commit 050454c

Please sign in to comment.