Skip to content

Commit

Permalink
return nil schema on error
Browse files Browse the repository at this point in the history
  • Loading branch information
nasermirzaei89 committed Apr 25, 2020
1 parent 02caa89 commit fcd314a
Show file tree
Hide file tree
Showing 23 changed files with 180 additions and 178 deletions.
10 changes: 5 additions & 5 deletions abstract_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func TestIsTypeOfUsedToResolveRuntimeTypeForInterface(t *testing.T) {
}

result := graphql.Do(graphql.Params{
Schema: schema,
Schema: *schema,
RequestString: query,
})
if len(result.Errors) != 0 {
Expand Down Expand Up @@ -284,7 +284,7 @@ func TestAppendTypeUsedToAddRuntimeCustomScalarTypeForInterface(t *testing.T) {
}

result := graphql.Do(graphql.Params{
Schema: schema,
Schema: *schema,
RequestString: query,
})
if len(result.Errors) != 0 {
Expand Down Expand Up @@ -384,7 +384,7 @@ func TestIsTypeOfUsedToResolveRuntimeTypeForUnion(t *testing.T) {
}

result := graphql.Do(graphql.Params{
Schema: schema,
Schema: *schema,
RequestString: query,
})
if len(result.Errors) != 0 {
Expand Down Expand Up @@ -523,7 +523,7 @@ func TestResolveTypeOnInterfaceYieldsUsefulError(t *testing.T) {
}

result := graphql.Do(graphql.Params{
Schema: schema,
Schema: *schema,
RequestString: query,
})
if !testutil.EqualResults(expected, result) {
Expand Down Expand Up @@ -647,7 +647,7 @@ func TestResolveTypeOnUnionYieldsUsefulError(t *testing.T) {
}

result := graphql.Do(graphql.Params{
Schema: schema,
Schema: *schema,
RequestString: query,
})
if !testutil.EqualResults(expected, result) {
Expand Down
2 changes: 1 addition & 1 deletion benchutil/list_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func ListSchemaWithXItems(x int) graphql.Schema {
Query: queryType,
})

return colorSchema
return *colorSchema
}

var colors []color
Expand Down
2 changes: 1 addition & 1 deletion benchutil/wide_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func WideSchemaWithXFieldsAndYItems(x int, y int) graphql.Schema {
Query: queryType,
})

return wideSchema
return *wideSchema
}

func generateXWideFields(x int) graphql.Fields {
Expand Down
2 changes: 1 addition & 1 deletion directives_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var directivesTestData map[string]interface{} = map[string]interface{}{
func executeDirectivesTestQuery(t *testing.T, doc string) *graphql.Result {
ast := testutil.TestParse(t, doc)
ep := graphql.ExecuteParams{
Schema: directivesTestSchema,
Schema: *directivesTestSchema,
AST: ast,
Root: directivesTestData,
}
Expand Down
8 changes: 4 additions & 4 deletions enum_type_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,14 @@ var enumTypeTestSchema, _ = graphql.NewSchema(graphql.SchemaConfig{

func executeEnumTypeTest(t *testing.T, query string) *graphql.Result {
result := g(t, graphql.Params{
Schema: enumTypeTestSchema,
Schema: *enumTypeTestSchema,
RequestString: query,
})
return result
}
func executeEnumTypeTestWithParams(t *testing.T, query string, params map[string]interface{}) *graphql.Result {
result := g(t, graphql.Params{
Schema: enumTypeTestSchema,
Schema: *enumTypeTestSchema,
RequestString: query,
VariableValues: params,
})
Expand Down Expand Up @@ -414,7 +414,7 @@ func TestTypeSystem_EnumValues_EnumValueMayBePointer(t *testing.T) {
"color": "GREEN",
"foo": 1}}}
result := g(t, graphql.Params{
Schema: enumTypeTestSchema,
Schema: *enumTypeTestSchema,
RequestString: query,
})
if !reflect.DeepEqual(expected, result) {
Expand Down Expand Up @@ -453,7 +453,7 @@ func TestTypeSystem_EnumValues_EnumValueMayBeNilPointer(t *testing.T) {
}},
}
result := g(t, graphql.Params{
Schema: enumTypeTestSchema,
Schema: *enumTypeTestSchema,
RequestString: query,
})
if !reflect.DeepEqual(expected, result) {
Expand Down
2 changes: 1 addition & 1 deletion executor_resolve_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func testSchema(t *testing.T, testField *graphql.Field) graphql.Schema {
if err != nil {
t.Fatalf("Invalid schema: %v", err)
}
return schema
return *schema
}

func TestExecutesResolveFunction_DefaultFunctionAccessesProperties(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion executor_schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ func TestExecutesUsingAComplexSchema(t *testing.T) {

// execute
ep := graphql.ExecuteParams{
Schema: blogSchema,
Schema: *blogSchema,
AST: ast,
}
result := testutil.TestExecute(t, ep)
Expand Down
Loading

0 comments on commit fcd314a

Please sign in to comment.