testutil

package
v0.0.0-...-74adf86 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package testutil provides test utilities for contract and integration tests

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertNoErrors

func AssertNoErrors(t *testing.T, resp *GraphQLResponse)

AssertNoErrors asserts that the GraphQL response has no errors

func GetTestServerURL

func GetTestServerURL() string

GetTestServerURL returns the test server URL from environment or default

func UnmarshalData

func UnmarshalData(t *testing.T, resp *GraphQLResponse, target interface{})

UnmarshalData unmarshals the GraphQL response data into the target struct

Types

type GraphQLError

type GraphQLError struct {
	Message    string                 `json:"message"`
	Path       []interface{}          `json:"path,omitempty"`
	Extensions map[string]interface{} `json:"extensions,omitempty"`
}

GraphQLError represents a GraphQL error

type GraphQLRequest

type GraphQLRequest struct {
	Query     string                 `json:"query"`
	Variables map[string]interface{} `json:"variables,omitempty"`
}

GraphQLRequest represents a GraphQL query request

type GraphQLResponse

type GraphQLResponse struct {
	Data       json.RawMessage        `json:"data"`
	Errors     []GraphQLError         `json:"errors,omitempty"`
	Extensions map[string]interface{} `json:"extensions,omitempty"`
}

GraphQLResponse represents a GraphQL query response

func ExecuteGraphQL

func ExecuteGraphQL(t *testing.T, serverURL string, query string, variables map[string]interface{}) *GraphQLResponse

ExecuteGraphQL executes a GraphQL query against the test server

Jump to

Keyboard shortcuts

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