Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Equal ¶
func Equal[T comparable](expected T) func(val T) error
Equal returns an assertion function that checks if the given value is equal to the expected value
Types ¶
type AssertionFunc ¶
func AssertEqual ¶
func AssertEqual(response any) AssertionFunc
AssertEqual asserts that the response body is equal to the given value It uses reflect.DeepEqual to compare the response body with the given value
func AssertExists ¶
func AssertExists(path string) AssertionFunc
AssertExists asserts that the value at the given path exists in the response body
func AssertPath ¶
func AssertPath[T comparable](path string, assert func(val T) error) AssertionFunc
AssertPath asserts that the value at the given path in the response body satisfies the given assertion the path is a dot separated string representing the path to the value in the response body e.g. "data.user.0.name" will navigate to the first user in the data array and check if the name field satisfies the given assertion
type Expect ¶
type Expect struct {
// contains filtered or unexported fields
}
func (*Expect) Body ¶
func (e *Expect) Body(assertionFunc AssertionFunc) *Expect
Body sets the expected response body
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
type TestPlan ¶
type TestPlan struct {
// contains filtered or unexported fields
}
func NewPlan ¶
NewPlan creates a new TestPlan The TestPlan is a collection of requests that will be run in order failing to call Run will result in a test failure
func (*TestPlan) ResponseForKey ¶
ResponseForKey returns the response body for a given key