testkit

package
v0.0.0-...-2c43d1c Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckAgainstGoldenFile

func CheckAgainstGoldenFile(t *testing.T, got map[string]interface{}, goldenDir, testName string, update *bool, opts *CompareOptions)

CheckAgainstGoldenFile sees if the JSON serialization of what we got matches a golden file.

got is the object we're testing. It will be rendered as JSON & compared with the golden file goldenDir defines the directory that holds golden files. testName is the name of the test, which will be sluggified to determine the golden file to use update is a flag that determines if we should update the golden file.

Types

type CompareOptions

type CompareOptions struct {
	// Whether to ignore date/times when comparing or writing the golden
	// file to disk
	DateTimeAgnostic bool
}

CompareOptions struct

type ConsumerContract

type ConsumerContract struct {
	GeneratedAt time.Time            `yaml:"generatedAt"`
	Operations  map[string]Operation `yaml:"operations"`
}

ConsumerContract struct

type Document

type Document string

Document and Variables types

type Operation

type Operation struct {
	Document  Document `yaml:"document"`
	Signature string   `yaml:"signature"`
}

Operation struct

type QueryRegistry

type QueryRegistry struct {
	// contains filtered or unexported fields
}

QueryRegistry struct

func LoadQueryRegistry

func LoadQueryRegistry(t *testing.T, queryDir, consumerContractFile string) *QueryRegistry

LoadQueryRegistry function

func (QueryRegistry) MustGet

func (reg QueryRegistry) MustGet(opName string) Document

MustGet function

func (QueryRegistry) NewRequest

func (reg QueryRegistry) NewRequest(opName string) *graphql.Request

NewRequest fuction

func (QueryRegistry) Register

func (reg QueryRegistry) Register(opName string, document Document) error

Register function

func (QueryRegistry) UnusedOperations

func (reg QueryRegistry) UnusedOperations() []string

UnusedOperations function

type Variables

type Variables map[string]interface{}

Variables struct

Jump to

Keyboard shortcuts

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