miscellaneous test coverage
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
# SimpleMutation creates a user.
|
||||
#
|
||||
# It has a long doc-comment, to test that we handle that correctly.
|
||||
# What a long comment indeed.
|
||||
mutation SimpleMutation($name: String!) {
|
||||
createUser(name: $name) {
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package test
|
||||
|
||||
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
|
||||
|
||||
import (
|
||||
"github.com/Khan/genqlient/graphql"
|
||||
)
|
||||
|
||||
type SimpleMutationCreateUser struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
type SimpleMutationResponse struct {
|
||||
CreateUser SimpleMutationCreateUser `json:"createUser"`
|
||||
}
|
||||
|
||||
// SimpleMutation creates a user.
|
||||
//
|
||||
// It has a long doc-comment, to test that we handle that correctly.
|
||||
// What a long comment indeed.
|
||||
func SimpleMutation(
|
||||
client graphql.Client,
|
||||
name string,
|
||||
) (*SimpleMutationResponse, error) {
|
||||
variables := map[string]interface{}{
|
||||
"name": name,
|
||||
}
|
||||
|
||||
var retval SimpleMutationResponse
|
||||
err := client.MakeRequest(
|
||||
nil,
|
||||
"SimpleMutation",
|
||||
`
|
||||
mutation SimpleMutation ($name: String!) {
|
||||
createUser(name: $name) {
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
`,
|
||||
&retval,
|
||||
variables,
|
||||
)
|
||||
return &retval, err
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"operations": [
|
||||
{
|
||||
"operationName": "SimpleMutation",
|
||||
"query": "\nmutation SimpleMutation ($name: String!) {\n\tcreateUser(name: $name) {\n\t\tid\n\t\tname\n\t}\n}\n",
|
||||
"sourceLocation": "testdata/queries/SimpleMutation.graphql"
|
||||
}
|
||||
]
|
||||
}
|
||||
+4
@@ -61,3 +61,7 @@ type Query {
|
||||
root: Topic!
|
||||
randomLeaf: LeafContent!
|
||||
}
|
||||
|
||||
type Mutation {
|
||||
createUser(name: String!, email: String): User
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user