File: mock_ticker.go

package info (click to toggle)
golang-github-pion-interceptor 0.1.12-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bookworm-backports, forky, sid, trixie
  • size: 764 kB
  • sloc: makefile: 8
file content (24 lines) | stat: -rw-r--r-- 398 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package test

import (
	"time"
)

// MockTicker is a helper to replace time.Ticker for testing purposes.
type MockTicker struct {
	C chan time.Time
}

// Stop stops the MockTicker.
func (t *MockTicker) Stop() {
}

// Ch returns the tickers channel
func (t *MockTicker) Ch() <-chan time.Time {
	return t.C
}

// Tick sends now to the channel
func (t *MockTicker) Tick(now time.Time) {
	t.C <- now
}