Skip to content

Commit

Permalink
Merge pull request #291 from fadi-alkatut/master
Browse files Browse the repository at this point in the history
check for errors before expected response in testing.go
  • Loading branch information
pavelnikolov authored Nov 16, 2018
2 parents 995849d + 050454c commit fd99376
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 fd99376

Please sign in to comment.