add test for manually triggered calls
This commit is contained in:
parent
fb4f17791e
commit
cfbbad3ff0
@ -29,7 +29,7 @@ func (c *CallTicker) Reset(d time.Duration) {
|
||||
c.ticker.Reset(d)
|
||||
}
|
||||
|
||||
func (c *CallTicker) Trigger() {
|
||||
func (c *CallTicker) Force() {
|
||||
c.manualTrigger <- true
|
||||
c.Reset(c.duration)
|
||||
}
|
||||
|
@ -28,4 +28,12 @@ func TestTicker(t *testing.T) {
|
||||
if num != 5 {
|
||||
t.Errorf("expected calls to stop")
|
||||
}
|
||||
|
||||
ticker.Force()
|
||||
time.Sleep(time.Millisecond * 10)
|
||||
|
||||
if num != 6 {
|
||||
t.Errorf("forced call did not run")
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user