helper

package
v0.2.0-beta Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HttpMockResJSON

func HttpMockResJSON(statusCode int, filePath string, headers map[string]string) httpmock.Responder

func StringToTime

func StringToTime(timeString string) time.Time

StringToTime return string to time without return error. If when parsing encounters an error, it will return the default value

func ToPtr

func ToPtr[V any](value V) *V

ToPtr return value pointer for anything data types.

Types

type Mocks

type Mocks struct {
	Api *mock_request.MockApi
}

type TestWrapper

type TestWrapper struct {
	Ctrl      *gomock.Controller
	ServerKey string
}

func NewTestWrapper

func NewTestWrapper(t *testing.T) *TestWrapper

func (*TestWrapper) DeepEqualPayload

func (w *TestWrapper) DeepEqualPayload(fileJson string, payload any, argPayload any) bool

DeepEqualPayload checks whether the payload for the request matches the example json or not. Value payload and argPayload must be assign as pointer

func (*TestWrapper) DeepEqualResponse

func (w *TestWrapper) DeepEqualResponse(gotRes any, wantRes any) bool

DeepEqualResponse is used to check responses that have interface values

func (*TestWrapper) ResJSONByte

func (w *TestWrapper) ResJSONByte(jsonFile string) []byte

ResJSONByte is used for convert file json to []byte

Jump to

Keyboard shortcuts

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