test

package
v0.1.1-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DB

func DB(t *testing.T) *db.MongoDB

func Endpoint

func Endpoint(t *testing.T, router *echo.Echo, tc APITestCase)

Endpoint tests an HTTP endpoint using the given APITestCase spec.

func InitLogger

func InitLogger() *zap.Logger

func MockRouter

func MockRouter() *echo.Echo

MockRouter creates a routing.Router for testing APIs.

Types

type APITestCase

type APITestCase struct {
	Name         string
	Method, URL  string
	Body         string
	Header       http.Header
	WantStatus   int
	WantResponse string
}

APITestCase represents the data needed to describe an API test case.

Jump to

Keyboard shortcuts

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