Skip to content

Commit

Permalink
chore(GraphQL): remove skipped tests (#6078)
Browse files Browse the repository at this point in the history
Fixes GRAPHQL-562.
  • Loading branch information
abhimanyusinghgaur authored Jul 27, 2020
1 parent 3f91f29 commit 91e28d5
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 101 deletions.
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 @@ -595,19 +595,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 @@ -1229,7 +1216,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 @@ -2001,51 +2001,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 @@ -2086,28 +2041,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 @@ -2458,7 +2391,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 @@ -2479,5 +2412,5 @@ func TestRestCustomLogicInDeepNestedField(t *testing.T) {
}
}
]
}`)
}`, string(result.Data))
}

0 comments on commit 91e28d5

Please sign in to comment.