gqltesting

package
v1.11.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2026 License: BSD-2-Clause Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 RunTest

func RunTest(t *testing.T, test *Test)

RunTest runs a single GraphQL test case.

func RunTests

func RunTests(t *testing.T, tests []*Test)

RunTests runs the given GraphQL test cases as subtests.

Types

type Test

type Test struct {
	Context        context.Context
	Schema         *graphql.Schema
	Query          string
	OperationName  string
	Variables      map[string]any
	ExpectedResult string
	ExpectedErrors []*errors.QueryError
	RawResponse    bool
}

Test is a GraphQL test case to be used with RunTest(s).

type TestResponse

type TestResponse struct {
	Data   json.RawMessage
	Errors []*errors.QueryError
}

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
	ExpectedErr     error
}

TestSubscription is a GraphQL test case to be used with RunSubscribe.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL