Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfMock ¶
type ConfMock struct {
// GetStringFunc mocks the GetString method.
GetStringFunc func(key string, defaultValue ...string) string
// UnmarshalFunc mocks the Unmarshal method.
UnmarshalFunc func(key string, config any, defaultValue ...any) error
// contains filtered or unexported fields
}
ConfMock is a mock implementation of Conf.
func TestSomethingThatUsesConf(t *testing.T) {
// make and configure a mocked Conf
mockedConf := &ConfMock{
GetStringFunc: func(key string, defaultValue ...string) string {
panic("mock out the GetString method")
},
UnmarshalFunc: func(key string, config any, defaultValue ...any) error {
panic("mock out the Unmarshal method")
},
}
// use mockedConf in code that requires Conf
// and then make assertions.
}
func (*ConfMock) GetStringCalls ¶
GetStringCalls gets all the calls that were made to GetString. Check the length with:
len(mockedConf.GetStringCalls())
Click to show internal directories.
Click to hide internal directories.