Documentation
¶
Index ¶
- Variables
- func ASTToJSON(t *testing.T, a ast.Node) any
- func ContainSubset(super map[string]any, sub map[string]any) bool
- func ContainSubsetSlice(super []any, sub []any) bool
- func ContextValue(ctx context.Context, k string) any
- func ContextWithValue(ctx context.Context, k string, v any) context.Context
- func Diff(want, got any) []string
- func EqualErrorMessage(expected, result *graphql.Result, i int) bool
- func EqualFormattedError(exp, act gqlerrors.FormattedError) bool
- func EqualFormattedErrors(expected, actual []gqlerrors.FormattedError) bool
- func EqualResults(expected, result *graphql.Result) bool
- func ExpectFailsRule(t *testing.T, rule graphql.ValidationRuleFn, queryString string, ...)
- func ExpectFailsRuleWithSchema(t *testing.T, schema *graphql.Schema, rule graphql.ValidationRuleFn, ...)
- func ExpectPassesRule(t *testing.T, rule graphql.ValidationRuleFn, queryString string)
- func ExpectPassesRuleWithSchema(t *testing.T, schema *graphql.Schema, rule graphql.ValidationRuleFn, ...)
- func PathFromRoot(t testing.TB, components ...string) string
- func RootDir(t testing.TB) string
- func RuleError(message string, locs ...int) gqlerrors.FormattedError
- func RunSubscribe(t *testing.T, test *TestSubscription)
- func RunSubscribes(t *testing.T, tests []*TestSubscription)
- func TestExecute(t *testing.T, ep graphql.ExecuteParams) *graphql.Result
- func TestParse(t *testing.T, query string) *ast.Document
- type TestResponse
- type TestSubscription
Constants ¶
This section is empty.
Variables ¶
View Source
var ( //go:embed introspection-query.graphql IntrospectionQuery string //go:embed applied-directive-introspection-query.graphql AppliedDirectiveIntrospectionQuery string )
View Source
var TestSchema *graphql.Schema
Functions ¶
func ContainSubsetSlice ¶
func ContextValue ¶ added in v0.0.3
ContextValue retrieves a value from the context.
func ContextWithValue ¶ added in v0.0.3
ContextWithValue inserts value into the context.
func EqualFormattedError ¶
func EqualFormattedError(exp, act gqlerrors.FormattedError) bool
func EqualFormattedErrors ¶
func EqualFormattedErrors(expected, actual []gqlerrors.FormattedError) bool
func EqualResults ¶
func ExpectFailsRule ¶
func ExpectFailsRule(t *testing.T, rule graphql.ValidationRuleFn, queryString string, expectedErrors []gqlerrors.FormattedError)
func ExpectFailsRuleWithSchema ¶
func ExpectFailsRuleWithSchema(t *testing.T, schema *graphql.Schema, rule graphql.ValidationRuleFn, queryString string, expectedErrors []gqlerrors.FormattedError)
func ExpectPassesRule ¶
func ExpectPassesRule(t *testing.T, rule graphql.ValidationRuleFn, queryString string)
func PathFromRoot ¶ added in v0.0.3
PathFromRoot calls RootDir and creates a path with the result and the provided slice of path components.
func RootDir ¶ added in v0.0.3
RootDir returns an absolute path to the root of the module. It fatally fails the test if the runtime information could not be obtained.
func RunSubscribe ¶
func RunSubscribe(t *testing.T, test *TestSubscription)
RunSubscribe runs a single GraphQL subscription test case.
func RunSubscribes ¶
func RunSubscribes(t *testing.T, tests []*TestSubscription)
RunSubscribes runs the given GraphQL subscription test cases as subtests.
func TestExecute ¶
Types ¶
type TestResponse ¶
TestResponse models the expected response
type TestSubscription ¶
type TestSubscription struct { Name string Schema graphql.Schema Query string OperationName string Variables map[string]any ExpectedResults []TestResponse }
TestSubscription is a GraphQL test case to be used with RunSubscribe.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.