Skip to content

Commit 37fc9f5

Browse files
authored
Merge pull request #23 from graphql-go/removes-relay-dependency
handler, travis: removes relay/context dependency
2 parents 07e3dd4 + 2de7caf commit 37fc9f5

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
language: go
22

33
go:
4-
- 1.4
4+
- 1.7
5+
- tip
56

67
before_install:
78
- go get github.com/axw/gocov/gocov

handler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99

1010
"github.com/graphql-go/graphql"
1111

12-
"golang.org/x/net/context"
12+
"context"
1313
)
1414

1515
const (

handler_test.go

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ import (
1313
"github.com/graphql-go/graphql"
1414
"github.com/graphql-go/graphql/testutil"
1515
"github.com/graphql-go/handler"
16-
"github.com/graphql-go/relay/examples/starwars" // TODO: remove this dependency
17-
"golang.org/x/net/context"
16+
"context"
1817
)
1918

2019
func decodeResponse(t *testing.T, recorder *httptest.ResponseRecorder) *graphql.Result {
@@ -53,7 +52,9 @@ func TestContextPropagated(t *testing.T) {
5352
},
5453
},
5554
})
56-
myNameSchema, err := graphql.NewSchema(graphql.SchemaConfig{myNameQuery, nil})
55+
myNameSchema, err := graphql.NewSchema(graphql.SchemaConfig{
56+
Query: myNameQuery,
57+
})
5758
if err != nil {
5859
t.Fatal(err)
5960
}
@@ -86,17 +87,16 @@ func TestContextPropagated(t *testing.T) {
8687
func TestHandler_BasicQuery_Pretty(t *testing.T) {
8788
expected := &graphql.Result{
8889
Data: map[string]interface{}{
89-
"rebels": map[string]interface{}{
90-
"id": "RmFjdGlvbjox",
91-
"name": "Alliance to Restore the Republic",
90+
"hero": map[string]interface{}{
91+
"name": "R2-D2",
9292
},
9393
},
9494
}
95-
queryString := `query=query RebelsShipsQuery { rebels { id, name } }`
95+
queryString := `query=query HeroNameQuery { hero { name } }`
9696
req, _ := http.NewRequest("GET", fmt.Sprintf("/graphql?%v", queryString), nil)
9797

9898
h := handler.New(&handler.Config{
99-
Schema: &starwars.Schema,
99+
Schema: &testutil.StarWarsSchema,
100100
Pretty: true,
101101
})
102102
result, resp := executeTest(t, h, req)
@@ -111,17 +111,16 @@ func TestHandler_BasicQuery_Pretty(t *testing.T) {
111111
func TestHandler_BasicQuery_Ugly(t *testing.T) {
112112
expected := &graphql.Result{
113113
Data: map[string]interface{}{
114-
"rebels": map[string]interface{}{
115-
"id": "RmFjdGlvbjox",
116-
"name": "Alliance to Restore the Republic",
114+
"hero": map[string]interface{}{
115+
"name": "R2-D2",
117116
},
118117
},
119118
}
120-
queryString := `query=query RebelsShipsQuery { rebels { id, name } }`
119+
queryString := `query=query HeroNameQuery { hero { name } }`
121120
req, _ := http.NewRequest("GET", fmt.Sprintf("/graphql?%v", queryString), nil)
122121

123122
h := handler.New(&handler.Config{
124-
Schema: &starwars.Schema,
123+
Schema: &testutil.StarWarsSchema,
125124
Pretty: false,
126125
})
127126
result, resp := executeTest(t, h, req)

0 commit comments

Comments
 (0)