testingutil

package
v0.0.0-...-58f8293 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Be

func Be[A any](e A) testingx.Matcher[A]

func Equal

func Equal[A any](e A) testingx.Matcher[A]

func Expect

func Expect[A any](t testing.TB, actual A, matcheres ...testingx.Matcher[A])

func HaveLen

func HaveLen[A any](c int) testingx.Matcher[A]

func MustJSONRaw

func MustJSONRaw(v interface{}) string

func NotBe

func NotBe[A any](e A) testingx.Matcher[A]

func NotEqual

func NotEqual[A any](e A) testingx.Matcher[A]

func NotHaveLen

func NotHaveLen[A any](c int) testingx.Matcher[A]

func PrintJSON

func PrintJSON(v interface{})

func ProjectRoot

func ProjectRoot() string

func RequestEqual

func RequestEqual(t testing.TB, req *http.Request, expect string)

func Serve

func Serve(t testing.TB, handler http.Handler) *httptest.Server

func ShouldReturnWhenRequest

func ShouldReturnWhenRequest(t testing.TB, h http.Handler, req any, httpResp string)

Types

type Datetime

type Datetime time.Time

openapi:strfmt date-time

func (Datetime) IsZero

func (dt Datetime) IsZero() bool

func (Datetime) MarshalText

func (dt Datetime) MarshalText() ([]byte, error)

func (*Datetime) UnmarshalText

func (dt *Datetime) UnmarshalText(data []byte) error

type MockResponseWriter

type MockResponseWriter struct {
	StatusCode int
	bytes.Buffer
	// contains filtered or unexported fields
}

func NewMockResponseWriter

func NewMockResponseWriter() *MockResponseWriter

func (*MockResponseWriter) Header

func (w *MockResponseWriter) Header() http.Header

func (*MockResponseWriter) MustDumpResponse

func (w *MockResponseWriter) MustDumpResponse() []byte

func (*MockResponseWriter) Response

func (w *MockResponseWriter) Response() *http.Response

func (*MockResponseWriter) WriteHeader

func (w *MockResponseWriter) WriteHeader(statusCode int)

Jump to

Keyboard shortcuts

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