diff --git a/connection_test.go b/connection_test.go index 219c6b2..23aea4d 100644 --- a/connection_test.go +++ b/connection_test.go @@ -124,7 +124,7 @@ func TestConnectionDefinition_IncludesConnectionAndEdgeFields(t *testing.T) { }, }, } - result := testGraphql(t, graphql.Params{ + result := graphql.Graphql(graphql.Params{ Schema: connectionTestSchema, RequestString: query, }) diff --git a/examples/starwars/connection_test.go b/examples/starwars/connection_test.go index 50a4c85..271cf92 100644 --- a/examples/starwars/connection_test.go +++ b/examples/starwars/connection_test.go @@ -8,13 +8,6 @@ import ( "testing" ) -func testGraphql(t *testing.T, p graphql.Params) *graphql.Result { - resultChannel := make(chan *graphql.Result) - go graphql.Graphql(p, resultChannel) - result := <-resultChannel - return result -} - func TestConnection_TestFetching_CorrectlyFetchesTheFirstShipOfTheRebels(t *testing.T) { query := ` query RebelsShipsQuery { @@ -46,7 +39,7 @@ func TestConnection_TestFetching_CorrectlyFetchesTheFirstShipOfTheRebels(t *test }, }, } - result := testGraphql(t, graphql.Params{ + result := graphql.Graphql(graphql.Params{ Schema: starwars.Schema, RequestString: query, }) @@ -93,7 +86,7 @@ func TestConnection_TestFetching_CorrectlyFetchesTheFirstTwoShipsOfTheRebelsWith }, }, } - result := testGraphql(t, graphql.Params{ + result := graphql.Graphql(graphql.Params{ Schema: starwars.Schema, RequestString: query, }) @@ -146,7 +139,7 @@ func TestConnection_TestFetching_CorrectlyFetchesTheNextThreeShipsOfTheRebelsWit }, }, } - result := testGraphql(t, graphql.Params{ + result := graphql.Graphql(graphql.Params{ Schema: starwars.Schema, RequestString: query, }) @@ -180,7 +173,7 @@ func TestConnection_TestFetching_CorrectlyFetchesNoShipsOfTheRebelsAtTheEndOfThe }, }, } - result := testGraphql(t, graphql.Params{ + result := graphql.Graphql(graphql.Params{ Schema: starwars.Schema, RequestString: query, }) @@ -262,7 +255,7 @@ func TestConnection_TestFetching_CorrectlyIdentifiesTheEndOfTheList(t *testing.T }, }, } - result := testGraphql(t, graphql.Params{ + result := graphql.Graphql(graphql.Params{ Schema: starwars.Schema, RequestString: query, }) diff --git a/examples/starwars/mutation_test.go b/examples/starwars/mutation_test.go index 2c04b18..aba4e24 100644 --- a/examples/starwars/mutation_test.go +++ b/examples/starwars/mutation_test.go @@ -44,7 +44,7 @@ func TestMutation_CorrectlyMutatesTheDataSet(t *testing.T) { }, }, } - result := testGraphql(t, graphql.Params{ + result := graphql.Graphql(graphql.Params{ Schema: starwars.Schema, RequestString: query, VariableValues: params, diff --git a/examples/starwars/object_identification_test.go b/examples/starwars/object_identification_test.go index 42c7320..efa1fa2 100644 --- a/examples/starwars/object_identification_test.go +++ b/examples/starwars/object_identification_test.go @@ -25,7 +25,7 @@ func TestObjectIdentification_TestFetching_CorrectlyFetchesTheIDAndTheNameOfTheR }, }, } - result := testGraphql(t, graphql.Params{ + result := graphql.Graphql(graphql.Params{ Schema: starwars.Schema, RequestString: query, }) @@ -52,7 +52,7 @@ func TestObjectIdentification_TestFetching_CorrectlyRefetchesTheRebels(t *testin }, }, } - result := testGraphql(t, graphql.Params{ + result := graphql.Graphql(graphql.Params{ Schema: starwars.Schema, RequestString: query, }) @@ -77,7 +77,7 @@ func TestObjectIdentification_TestFetching_CorrectlyFetchesTheIDAndTheNameOfTheE }, }, } - result := testGraphql(t, graphql.Params{ + result := graphql.Graphql(graphql.Params{ Schema: starwars.Schema, RequestString: query, }) @@ -104,7 +104,7 @@ func TestObjectIdentification_TestFetching_CorrectlyRefetchesTheEmpire(t *testin }, }, } - result := testGraphql(t, graphql.Params{ + result := graphql.Graphql(graphql.Params{ Schema: starwars.Schema, RequestString: query, }) @@ -131,7 +131,7 @@ func TestObjectIdentification_TestFetching_CorrectlyRefetchesTheXWing(t *testing }, }, } - result := testGraphql(t, graphql.Params{ + result := graphql.Graphql(graphql.Params{ Schema: starwars.Schema, RequestString: query, }) diff --git a/mutation_test.go b/mutation_test.go index d64e857..cbae0d2 100644 --- a/mutation_test.go +++ b/mutation_test.go @@ -79,7 +79,7 @@ func TestMutation_WithClientMutationId_BehavesCorrectly_RequiresAnArgument(t *te }, }, } - result := testGraphql(t, graphql.Params{ + result := graphql.Graphql(graphql.Params{ Schema: mutationTestSchema, RequestString: query, }) @@ -104,7 +104,7 @@ func TestMutation_WithClientMutationId_BehavesCorrectly_ReturnsTheSameClientMuta }, }, } - result := testGraphql(t, graphql.Params{ + result := graphql.Graphql(graphql.Params{ Schema: mutationTestSchema, RequestString: query, }) @@ -131,7 +131,7 @@ func TestMutation_WithClientMutationId_BehavesCorrectly_SupportsPromiseMutations }, }, } - result := testGraphql(t, graphql.Params{ + result := graphql.Graphql(graphql.Params{ Schema: mutationTestSchema, RequestString: query, }) @@ -178,7 +178,7 @@ func TestMutation_IntrospectsCorrectly_ContainsCorrectInput(t *testing.T) { }, }, } - result := testGraphql(t, graphql.Params{ + result := graphql.Graphql(graphql.Params{ Schema: mutationTestSchema, RequestString: query, }) @@ -233,7 +233,7 @@ func TestMutation_IntrospectsCorrectly_ContainsCorrectPayload(t *testing.T) { }, }, } - result := testGraphql(t, graphql.Params{ + result := graphql.Graphql(graphql.Params{ Schema: mutationTestSchema, RequestString: query, }) @@ -316,7 +316,7 @@ func TestMutation_IntrospectsCorrectly_ContainsCorrectField(t *testing.T) { }, }, } - result := testGraphql(t, graphql.Params{ + result := graphql.Graphql(graphql.Params{ Schema: mutationTestSchema, RequestString: query, }) diff --git a/node_global_test.go b/node_global_test.go index 62c9fb2..3f0a64c 100644 --- a/node_global_test.go +++ b/node_global_test.go @@ -130,7 +130,7 @@ func TestGlobalIDFields_GivesDifferentIDs(t *testing.T) { }, }, } - result := testGraphql(t, graphql.Params{ + result := graphql.Graphql(graphql.Params{ Schema: globalIDTestSchema, RequestString: query, }) @@ -166,7 +166,7 @@ func TestGlobalIDFields_RefetchesTheIDs(t *testing.T) { }, }, } - result := testGraphql(t, graphql.Params{ + result := graphql.Graphql(graphql.Params{ Schema: globalIDTestSchema, RequestString: query, }) diff --git a/node_test.go b/node_test.go index ed39164..98ef832 100644 --- a/node_test.go +++ b/node_test.go @@ -93,13 +93,6 @@ func init() { Query: nodeTestQueryType, }) } - -func testGraphql(t *testing.T, p graphql.Params) *graphql.Result { - resultChannel := make(chan *graphql.Result) - go graphql.Graphql(p, resultChannel) - result := <-resultChannel - return result -} func TestNodeInterfaceAndFields_AllowsRefetching_GetsTheCorrectIDForUsers(t *testing.T) { query := `{ node(id: "1") { @@ -113,7 +106,7 @@ func TestNodeInterfaceAndFields_AllowsRefetching_GetsTheCorrectIDForUsers(t *tes }, }, } - result := testGraphql(t, graphql.Params{ + result := graphql.Graphql(graphql.Params{ Schema: nodeTestSchema, RequestString: query, }) @@ -134,7 +127,7 @@ func TestNodeInterfaceAndFields_AllowsRefetching_GetsTheCorrectIDForPhotos(t *te }, }, } - result := testGraphql(t, graphql.Params{ + result := graphql.Graphql(graphql.Params{ Schema: nodeTestSchema, RequestString: query, }) @@ -159,7 +152,7 @@ func TestNodeInterfaceAndFields_AllowsRefetching_GetsTheCorrectNameForUsers(t *t }, }, } - result := testGraphql(t, graphql.Params{ + result := graphql.Graphql(graphql.Params{ Schema: nodeTestSchema, RequestString: query, }) @@ -184,7 +177,7 @@ func TestNodeInterfaceAndFields_AllowsRefetching_GetsTheCorrectWidthForPhotos(t }, }, } - result := testGraphql(t, graphql.Params{ + result := graphql.Graphql(graphql.Params{ Schema: nodeTestSchema, RequestString: query, }) @@ -207,7 +200,7 @@ func TestNodeInterfaceAndFields_AllowsRefetching_GetsTheCorrectTypeNameForUsers( }, }, } - result := testGraphql(t, graphql.Params{ + result := graphql.Graphql(graphql.Params{ Schema: nodeTestSchema, RequestString: query, }) @@ -230,7 +223,7 @@ func TestNodeInterfaceAndFields_AllowsRefetching_GetsTheCorrectTypeNameForPhotos }, }, } - result := testGraphql(t, graphql.Params{ + result := graphql.Graphql(graphql.Params{ Schema: nodeTestSchema, RequestString: query, }) @@ -254,7 +247,7 @@ func TestNodeInterfaceAndFields_AllowsRefetching_IgnoresPhotoFragmentsOnUser(t * }, }, } - result := testGraphql(t, graphql.Params{ + result := graphql.Graphql(graphql.Params{ Schema: nodeTestSchema, RequestString: query, }) @@ -273,7 +266,7 @@ func TestNodeInterfaceAndFields_AllowsRefetching_ReturnsNullForBadIDs(t *testing "node": nil, }, } - result := testGraphql(t, graphql.Params{ + result := graphql.Graphql(graphql.Params{ Schema: nodeTestSchema, RequestString: query, }) @@ -318,7 +311,7 @@ func TestNodeInterfaceAndFields_CorrectlyIntrospects_HasCorrectNodeInterface(t * }, }, } - result := testGraphql(t, graphql.Params{ + result := graphql.Graphql(graphql.Params{ Schema: nodeTestSchema, RequestString: query, }) @@ -379,7 +372,7 @@ func TestNodeInterfaceAndFields_CorrectlyIntrospects_HasCorrectNodeRootField(t * }, }, } - result := testGraphql(t, graphql.Params{ + result := graphql.Graphql(graphql.Params{ Schema: nodeTestSchema, RequestString: query, }) diff --git a/plural_test.go b/plural_test.go index 7fa85c8..e84073d 100644 --- a/plural_test.go +++ b/plural_test.go @@ -68,7 +68,7 @@ func TestPluralIdentifyingRootField_AllowsFetching(t *testing.T) { }, }, } - result := testGraphql(t, graphql.Params{ + result := graphql.Graphql(graphql.Params{ Schema: pluralTestSchema, RequestString: query, }) @@ -147,7 +147,7 @@ func TestPluralIdentifyingRootField_CorrectlyIntrospects(t *testing.T) { }, }, } - result := testGraphql(t, graphql.Params{ + result := graphql.Graphql(graphql.Params{ Schema: pluralTestSchema, RequestString: query, }) @@ -185,7 +185,7 @@ func TestPluralIdentifyingRootField_Configuration_ResolveSingleInputIsNil(t *tes "usernames": nil, }, } - result := testGraphql(t, graphql.Params{ + result := graphql.Graphql(graphql.Params{ Schema: pluralTestSchema, RequestString: query, }) @@ -206,7 +206,7 @@ func TestPluralIdentifyingRootField_Configuration_ArgNames_WrongArgNameSpecified "usernames": nil, }, } - result := testGraphql(t, graphql.Params{ + result := graphql.Graphql(graphql.Params{ Schema: pluralTestSchema, RequestString: query, })