testutil

package
v0.0.0-...-15f65a9 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UnmarshalBody

func UnmarshalBody[Body any](t *testing.T, r *httptest.ResponseRecorder, body *Body)

Post is a helper function to make a POST request to the API. It will hanndle serializing the request and response objects to and from JSON.

Types

type Harness

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

func NewHarness

func NewHarness(t *testing.T) *Harness

func (*Harness) Register

func (h *Harness) Register(route *routes.Route)

func (*Harness) SetupRoute

func (h *Harness) SetupRoute(constructor func(svc routes.Services) *routes.Route) *routes.Route

type TestResponse

type TestResponse[TBody any] struct {
	Status  int
	Headers http.Header
	Body    TBody
}

func CallRoute

func CallRoute[Req any, Res any](t *testing.T, route *routes.Route, headers http.Header, req Req) TestResponse[Res]

Jump to

Keyboard shortcuts

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