(t *testing.T)
| 68 | ) |
| 69 | |
| 70 | func TestCustomGetQuery(t *testing.T) { |
| 71 | schema := customTypes + ` |
| 72 | type Query { |
| 73 | myFavoriteMovies(id: ID!, name: String!, num: Int): [Movie] @custom(http: { |
| 74 | url: "http://mock:8888/favMovies/$id?name=$name&num=$num", |
| 75 | method: "GET" |
| 76 | }) |
| 77 | }` |
| 78 | common.SafelyUpdateGQLSchemaOnAlpha1(t, schema) |
| 79 | |
| 80 | query := ` |
| 81 | query { |
| 82 | myFavoriteMovies(id: "0x123", name: "Author", num: 10) { |
| 83 | id |
| 84 | name |
| 85 | director { |
| 86 | id |
| 87 | name |
| 88 | } |
| 89 | } |
| 90 | }` |
| 91 | params := &common.GraphQLParams{ |
| 92 | Query: query, |
| 93 | } |
| 94 | |
| 95 | result := params.ExecuteAsPost(t, common.GraphqlURL) |
| 96 | common.RequireNoGQLErrors(t, result) |
| 97 | |
| 98 | expected := `{"myFavoriteMovies":[{"id":"0x3","name":"Star Wars","director":[{"id":"0x4","name":"George Lucas"}]},{"id":"0x5","name":"Star Trek","director":[{"id":"0x6","name":"J.J. Abrams"}]}]}` |
| 99 | require.JSONEq(t, expected, string(result.Data)) |
| 100 | } |
| 101 | |
| 102 | func TestCustomPostQuery(t *testing.T) { |
| 103 | schema := customTypes + ` |
nothing calls this directly
no test coverage detected