Documentation
¶
Index ¶
- Constants
- func Assert(t *testing.T, r *http.Response, opts AssertionOptions)
- func Body(t *testing.T, v any, m contract.Marshaler) *bytes.Reader
- func Extract[T comparable](t *testing.T, body io.Reader, u contract.Unmarshaler, field string, to *[]T, ...)
- func FailOnError(t *testing.T, err error)
- func Log(ctx context.Context, t *testing.T, logger contract.LogOperator, ...) error
- type AssertionOption
- type AssertionOptions
- type ExtractionOption
- type ExtractionOptions
- type LogOption
- type LogOptions
Constants ¶
View Source
const ( MsgSent = "| Sent 🌎 |" MsgReceived = "| Received 📮 |" MsgInsertOne = "Insert One" MsgFindMany = "Find Many" MsgFindOne = "Find One" MsgReplaceOne = "Replace One" MsgActions = "Actions" MsgDeleteOne = "Delete One" )
Variables ¶
This section is empty.
Functions ¶
func Assert ¶
func Assert(t *testing.T, r *http.Response, opts AssertionOptions)
Assert verifies that the response status is within the accepted statuses.
func Extract ¶
func Extract[T comparable](t *testing.T, body io.Reader, u contract.Unmarshaler, field string, to *[]T, opts ExtractionOptions)
Extract extracts a field from the response body.
func FailOnError ¶
FailOnError fails the test if the error is not nil.
Types ¶
type AssertionOption ¶
type AssertionOption func(*AssertionOptions)
func WithExpected ¶
func WithExpected(expected []int) AssertionOption
type AssertionOptions ¶
type AssertionOptions struct {
Expected []int
}
func ApplyAssertionOptions ¶
func ApplyAssertionOptions(opts *AssertionOptions, modifiers ...AssertionOption) AssertionOptions
type ExtractionOption ¶
type ExtractionOption func(*ExtractionOptions)
func WithBypass ¶
func WithBypass(bypass bool) ExtractionOption
WithBypass specifies whether to bypass the extraction.
type ExtractionOptions ¶
type ExtractionOptions struct {
Bypass bool
}
func ApplyExtractionOptions ¶
func ApplyExtractionOptions(opts *ExtractionOptions, modifiers ...ExtractionOption) ExtractionOptions
type LogOption ¶
type LogOption func(*LogOptions)
func WithCollection ¶
func WithMethod ¶
func WithTestCaseName ¶
func WithTestDescription ¶
func WithTestMessage ¶
type LogOptions ¶
type LogOptions struct {
Method string
URL string
TestMessage string
TestCaseName string
Collection string
TestDescription string
}
func ApplyLogOptions ¶
func ApplyLogOptions(opts *LogOptions, modifiers ...LogOption) LogOptions
Click to show internal directories.
Click to hide internal directories.