From d1aa136cd46d3b29b3cb4e406d2b3ad8ba17fdc6 Mon Sep 17 00:00:00 2001 From: Chris Pride Date: Mon, 18 Apr 2022 16:40:57 +0000 Subject: [PATCH] Rebase on updated origin/master. Fix the test to not be sensitive to array ordering. Re-generate on master as there was a schema change. --- codegen/testserver/followschema/nulls_test.go | 3 ++- codegen/testserver/followschema/schema.generated.go | 2 +- codegen/testserver/singlefile/generated.go | 2 +- codegen/testserver/singlefile/nulls_test.go | 3 ++- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/codegen/testserver/followschema/nulls_test.go b/codegen/testserver/followschema/nulls_test.go index 2572b21b9a..4375adbc1b 100644 --- a/codegen/testserver/followschema/nulls_test.go +++ b/codegen/testserver/followschema/nulls_test.go @@ -93,7 +93,8 @@ func TestNullBubbling(t *testing.T) { } err := c.Post(`query { valid, errorBubbleList { id } }`, &resp) - require.EqualError(t, err, `[{"message":"the requested element is null which the schema does not allow","path":["errorBubbleList",2]},{"message":"the requested element is null which the schema does not allow","path":["errorBubbleList",1]}]`) + require.Contains(t, err.Error(), `{"message":"the requested element is null which the schema does not allow","path":["errorBubbleList",2]}`) + require.Contains(t, err.Error(), `{"message":"the requested element is null which the schema does not allow","path":["errorBubbleList",1]}`) require.Nil(t, resp.ErrorBubbleList) require.Equal(t, "Ok", resp.Valid) }) diff --git a/codegen/testserver/followschema/schema.generated.go b/codegen/testserver/followschema/schema.generated.go index 2cad9a7e72..90caf3f44d 100644 --- a/codegen/testserver/followschema/schema.generated.go +++ b/codegen/testserver/followschema/schema.generated.go @@ -7365,7 +7365,7 @@ func (ec *executionContext) marshalNInnerObject2ᚖgithubᚗcomᚋ99designsᚋgq func (ec *executionContext) marshalNPet2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋfollowschemaᚐPet(ctx context.Context, sel ast.SelectionSet, v *Pet) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") + ec.Errorf(ctx, "the requested element is null which the schema does not allow") } return graphql.Null } diff --git a/codegen/testserver/singlefile/generated.go b/codegen/testserver/singlefile/generated.go index dcc8e3a137..97fd25466a 100644 --- a/codegen/testserver/singlefile/generated.go +++ b/codegen/testserver/singlefile/generated.go @@ -19775,7 +19775,7 @@ func (ec *executionContext) marshalNNode2githubᚗcomᚋ99designsᚋgqlgenᚋcod func (ec *executionContext) marshalNPet2ᚖgithubᚗcomᚋ99designsᚋgqlgenᚋcodegenᚋtestserverᚋsinglefileᚐPet(ctx context.Context, sel ast.SelectionSet, v *Pet) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "must not be null") + ec.Errorf(ctx, "the requested element is null which the schema does not allow") } return graphql.Null } diff --git a/codegen/testserver/singlefile/nulls_test.go b/codegen/testserver/singlefile/nulls_test.go index d961833fd4..e119f7c1b3 100644 --- a/codegen/testserver/singlefile/nulls_test.go +++ b/codegen/testserver/singlefile/nulls_test.go @@ -93,7 +93,8 @@ func TestNullBubbling(t *testing.T) { } err := c.Post(`query { valid, errorBubbleList { id } }`, &resp) - require.EqualError(t, err, `[{"message":"the requested element is null which the schema does not allow","path":["errorBubbleList",2]},{"message":"the requested element is null which the schema does not allow","path":["errorBubbleList",1]}]`) + require.Contains(t, err.Error(), `{"message":"the requested element is null which the schema does not allow","path":["errorBubbleList",2]}`) + require.Contains(t, err.Error(), `{"message":"the requested element is null which the schema does not allow","path":["errorBubbleList",1]}`) require.Nil(t, resp.ErrorBubbleList) require.Equal(t, "Ok", resp.Valid) })