mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-05 13:37:38 +03:00
28 lines
443 B
Go
28 lines
443 B
Go
package engine
|
|
|
|
import (
|
|
"errors"
|
|
"time"
|
|
)
|
|
|
|
func CreateMockNowPlayingRepo() *MockNowPlaying {
|
|
return &MockNowPlaying{data: make(map[string]time.Time)}
|
|
}
|
|
|
|
type MockNowPlaying struct {
|
|
NowPlayingRepository
|
|
data map[string]time.Time
|
|
err bool
|
|
}
|
|
|
|
func (m *MockNowPlaying) SetError(err bool) {
|
|
m.err = err
|
|
}
|
|
|
|
func (m *MockNowPlaying) Add(id string) error {
|
|
if m.err {
|
|
return errors.New("Error!")
|
|
}
|
|
m.data[id] = time.Now()
|
|
return nil
|
|
}
|