Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cherry-pick v20.07: chore(GraphQL): remove skipped tests (#6078) #6347

Merged
merged 1 commit into from
Sep 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions graphql/e2e/custom_logic/cmd/graphqlresponse.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -437,24 +437,6 @@
getPosts(input: [PostFilterInput]): [Post!]
}

- name: getPostswithLike
schema: |
input PostFilterInput{
id: ID!
text: String!
likes: Int
}

type Post {
id: ID!
text: String
comments: Post!
}

type Query{
getPosts(input: [PostFilterInput]): [Post!]
}

- name: "carsschema"
schema: |
type Car {
Expand Down
14 changes: 0 additions & 14 deletions graphql/e2e/custom_logic/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -639,19 +639,6 @@ func getPosts(w http.ResponseWriter, r *http.Request) {
check2(fmt.Fprint(w, generateIntrospectionResult(graphqlResponses["getPosts"].Schema)))
}

func getPostswithLike(w http.ResponseWriter, r *http.Request) {
_, err := verifyGraphqlRequest(r, expectedGraphqlRequest{
urlSuffix: "/getPostswithLike",
body: ``,
})
if err != nil {
check2(w.Write([]byte(err.Error())))
return
}

check2(fmt.Fprint(w, generateIntrospectionResult(graphqlResponses["getPostswithLike"].Schema)))
}

type input struct {
ID string `json:"uid"`
}
Expand Down Expand Up @@ -1308,7 +1295,6 @@ func main() {
bsch := graphql.MustParseSchema(graphqlResponses["batchOperationSchema"].Schema, &query{})
bh := &relay.Handler{Schema: bsch}
http.HandleFunc("/getPosts", getPosts)
http.HandleFunc("/getPostswithLike", getPostswithLike)
http.Handle("/gqlUserNames", bh)
http.Handle("/gqlCars", bh)
http.HandleFunc("/gqlCarsWithErrors", gqlCarsWithErrorHandler)
Expand Down
71 changes: 2 additions & 69 deletions graphql/e2e/custom_logic/custom_logic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2214,51 +2214,6 @@ func TestCustomGraphqlMissingTypeForBatchedFieldInput(t *testing.T) {
"PostFilterInput.\n")
}

func TestCustomGraphqlInvalidArgForBatchedField(t *testing.T) {
t.Skip()
schema := `
type Post {
id: ID!
text: String
comments: Post! @custom(http: {
url: "http://mock:8888/getPosts",
method: "POST",
mode: BATCH
graphql: "query { getPosts(input: [{name: $id}]) }"
})
}
`
res := updateSchema(t, schema)
require.Equal(t, `{"updateGQLSchema":null}`, string(res.Data))
require.Len(t, res.Errors, 1)
require.Equal(t, "resolving updateGQLSchema failed because input:9: Type Post"+
"; Field comments: inside graphql in @custom directive, argument `name` is not present "+
"in remote query `getPosts`.\n", res.Errors[0].Error())
}

func TestCustomGraphqlArgTypeMismatchForBatchedField(t *testing.T) {
t.Skip()
schema := `
type Post {
id: ID!
likes: Int
text: String
comments: Post! @custom(http: {
url: "http://mock:8888/getPostswithLike",
method: "POST",
mode: BATCH
graphql: "query { getPosts(input: [{id: $id, text: $likes}]) }"
})
}
`
res := updateSchema(t, schema)
require.Equal(t, `{"updateGQLSchema":null}`, string(res.Data))
require.Len(t, res.Errors, 1)
require.Equal(t, "resolving updateGQLSchema failed because input:10: Type Post"+
"; Field comments: inside graphql in @custom directive, found type mismatch for variable"+
" `$likes` in query `getPosts`, expected `Int`, got `String!`.\n", res.Errors[0].Error())
}

func TestCustomGraphqlMissingRequiredArgument(t *testing.T) {
schema := `
type Country @remote {
Expand Down Expand Up @@ -2299,28 +2254,6 @@ func TestCustomGraphqlMissingRequiredArgument(t *testing.T) {
" `setCountry` is missing, it is required by remote mutation.")
}

func TestCustomGraphqlMissingRequiredArgumentForBatchedField(t *testing.T) {
t.Skip()
schema := `
type Post {
id: ID!
text: String
comments: Post! @custom(http: {
url: "http://mock:8888/getPosts",
method: "POST",
mode: BATCH
graphql: "query { getPosts(input: [{id: $id}]) }"
})
}
`
res := updateSchema(t, schema)
require.Equal(t, `{"updateGQLSchema":null}`, string(res.Data))
require.Len(t, res.Errors, 1)
require.Equal(t, "resolving updateGQLSchema failed because input:9: Type Post"+
"; Field comments: inside graphql in @custom directive, argument `text` in query "+
"`getPosts` is missing, it is required by remote query.\n", res.Errors[0].Error())
}

// this one accepts an object and returns an object
func TestCustomGraphqlMutation1(t *testing.T) {
schema := `
Expand Down Expand Up @@ -2671,7 +2604,7 @@ func TestRestCustomLogicInDeepNestedField(t *testing.T) {

result = params.ExecuteAsPost(t, alphaURL)
common.RequireNoGQLErrors(t, result)
require.JSONEq(t, string(result.Data), `
testutil.CompareJSON(t, `
{
"querySearchTweets": [
{
Expand All @@ -2692,5 +2625,5 @@ func TestRestCustomLogicInDeepNestedField(t *testing.T) {
}
}
]
}`)
}`, string(result.Data))
}