MCPcopy Create free account
hub / github.com/cabify/timex / Timer

Interface Timer

timer.go:10–16  ·  view source on GitHub ↗

Timer is an interface similar to what time.Timer provides, but with C as a function returning the channel instead of accessing a plain struct property, so we can mock it. See time.Timer docs for more details

Source from the content-addressed store, hash-verified

8// instead of accessing a plain struct property, so we can mock it.
9// See time.Timer docs for more details
10type Timer interface {
11 // C returns the channel where the tick will be signaled, like Timer.C in time package
12 C() <-chan time.Time
13
14 // Stop stops the timer, see exact docs on time.Timer for information about channel draining when Stop returns false
15 Stop() bool
16}
17
18//go:generate mockery -case underscore -outpkg timexmock -output timexmock -name Timer
19type timer struct {

Callers 8

TestNewTimerFunction · 0.95
TestDefault_NewTimerFunction · 0.95
AfterMethod · 0.65
TestNewTimerFunction · 0.95
TestDefault_NewTimerFunction · 0.95
TestMockedTimer_TriggerFunction · 0.95

Implementers 4

MockedTimertimextest/mocked_timer.go
MockedTickertimextest/mocked_ticker.go
Tickertimexmock/ticker.go
Timertimexmock/timer.go

Calls

no outgoing calls

Tested by

no test coverage detected