Skip to content

Commit

Permalink
Add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathew Byrne committed Oct 2, 2018
1 parent b836a97 commit 0c39927
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 2 deletions.
72 changes: 70 additions & 2 deletions codegen/testserver/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions codegen/testserver/generated_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,15 @@ func TestGeneratedServer(t *testing.T) {
sub.Close()
})
})

t.Run("null args", func(t *testing.T) {
var resp struct {
NullableArg *string
}
err := c.Post(`query { nullableArg(arg: null) }`, &resp)
require.Nil(t, err)
require.Nil(t, resp.NullableArg)
})
}

func TestResponseExtension(t *testing.T) {
Expand Down
3 changes: 3 additions & 0 deletions codegen/testserver/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ func (r *queryResolver) Valid(ctx context.Context) (string, error) {
func (r *queryResolver) User(ctx context.Context, id int) (User, error) {
panic("not implemented")
}
func (r *queryResolver) NullableArg(ctx context.Context, arg int) (*string, error) {
panic("not implemented")
}
func (r *queryResolver) KeywordArgs(ctx context.Context, breakArg string, defaultArg string, funcArg string, interfaceArg string, selectArg string, caseArg string, deferArg string, goArg string, mapArg string, structArg string, chanArg string, elseArg string, gotoArg string, packageArg string, switchArg string, constArg string, fallthroughArg string, ifArg string, rangeArg string, typeArg string, continueArg string, forArg string, importArg string, returnArg string, varArg string) (bool, error) {
panic("not implemented")
}
Expand Down
1 change: 1 addition & 0 deletions codegen/testserver/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ type Query {
errorBubble: Error
valid: String!
user(id: Int!): User!
nullableArg(arg: Int = 123): String
}

type Subscription {
Expand Down

0 comments on commit 0c39927

Please sign in to comment.