Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var RealTimeProvider = sync.OnceValue(func() *realTimeProvider {
return &realTimeProvider{}
})
Functions ¶
This section is empty.
Types ¶
type TimeProvider ¶
type TimeProviderMock ¶
type TimeProviderMock struct {
// NowFunc mocks the Now method.
NowFunc func() time.Time
// contains filtered or unexported fields
}
TimeProviderMock is a mock implementation of TimeProvider.
func TestSomethingThatUsesTimeProvider(t *testing.T) {
// make and configure a mocked TimeProvider
mockedTimeProvider := &TimeProviderMock{
NowFunc: func() time.Time {
panic("mock out the Now method")
},
}
// use mockedTimeProvider in code that requires TimeProvider
// and then make assertions.
}
func (*TimeProviderMock) NowCalls ¶
func (mock *TimeProviderMock) NowCalls() []struct { }
NowCalls gets all the calls that were made to Now. Check the length with:
len(mockedTimeProvider.NowCalls())
Click to show internal directories.
Click to hide internal directories.