From 050454c90fa1eeeedb5c59a7dd147ca70a645645 Mon Sep 17 00:00:00 2001 From: fadi-alkatut <44017676+fadi-alkatut@users.noreply.github.com> Date: Wed, 14 Nov 2018 08:47:50 +1100 Subject: [PATCH] Update testing.go check for errors before expected response --- gqltesting/testing.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gqltesting/testing.go b/gqltesting/testing.go index 85ab4c35..5f4e634d 100644 --- a/gqltesting/testing.go +++ b/gqltesting/testing.go @@ -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 { @@ -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)