api

package
v0.0.0-...-660f087 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2023 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	Start(port string) error
}

func New

func New(logger zerolog.Logger, r chi.Router, app application.App) API

type APIMock

type APIMock struct {
	// StartFunc mocks the Start method.
	StartFunc func(port string) error
	// contains filtered or unexported fields
}

APIMock is a mock implementation of API.

func TestSomethingThatUsesAPI(t *testing.T) {

	// make and configure a mocked API
	mockedAPI := &APIMock{
		StartFunc: func(port string) error {
			panic("mock out the Start method")
		},
	}

	// use mockedAPI in code that requires API
	// and then make assertions.

}

func (*APIMock) Start

func (mock *APIMock) Start(port string) error

Start calls StartFunc.

func (*APIMock) StartCalls

func (mock *APIMock) StartCalls() []struct {
	Port string
}

StartCalls gets all the calls that were made to Start. Check the length with:

len(mockedAPI.StartCalls())

Jump to

Keyboard shortcuts

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