Documentation
¶
Index ¶
- Constants
- func AssertError(t *testing.T, resp *http.Response, wantCode wserr.Code) wserr.Error
- func AssertHTTPStatus(t *testing.T, got, want int, body []byte)
- func DecodeJSON[T any](t *testing.T, b []byte) T
- func OpenTestDB(t *testing.T) *sql.DB
- func ReadBody(t *testing.T, r io.Reader) []byte
- func WithTimeout(t *testing.T, d time.Duration) context.Context
- type HTTPServerOptions
- type HTTPTestServer
Constants ¶
View Source
const EnvTestDBDSN = "TEST_DB_DSN"
Variables ¶
This section is empty.
Functions ¶
func AssertError ¶
Types ¶
type HTTPServerOptions ¶
type HTTPTestServer ¶
func NewServer ¶
func NewServer(h http.Handler, opts HTTPServerOptions) *HTTPTestServer
NewServer spins up an httptest server with a standard middleware chain. Keep it router-agnostic: caller provides the final handler.
func (*HTTPTestServer) Close ¶
func (s *HTTPTestServer) Close()
Click to show internal directories.
Click to hide internal directories.