NewQueryMatcher constructs a new matcher for the provided query and variables. If the provided query is a string, it will be used-as-is, otherwise it will be converted to a string using the constructQuery function taken from shurcooL/graphql.
(query any, variables map[string]any, response GQLResponse)
| 20 | // If the provided query is a string, it will be used-as-is, otherwise it will be |
| 21 | // converted to a string using the constructQuery function taken from shurcooL/graphql. |
| 22 | func NewQueryMatcher(query any, variables map[string]any, response GQLResponse) Matcher { |
| 23 | queryString, ok := query.(string) |
| 24 | if !ok { |
| 25 | queryString = constructQuery(query, variables) |
| 26 | } |
| 27 | |
| 28 | return Matcher{ |
| 29 | Request: queryString, |
| 30 | Variables: variables, |
| 31 | Response: response, |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | // NewMutationMatcher constructs a new matcher for the provided mutation and variables. |
| 36 | // If the provided mutation is a string, it will be used-as-is, otherwise it will be |