Documentation
¶
Index ¶
- type MockDevices
- type MockLibrary
- func (m *MockLibrary) AlbumTracks(_ context.Context, _ string, _, _ int) ([]api.Track, bool, error)
- func (m *MockLibrary) GetPlaylist(_ context.Context, _ string) ([]api.Track, int, bool, error)
- func (m *MockLibrary) LikeTrack(_ context.Context, _ string) error
- func (m *MockLibrary) LikedTracks(_ context.Context, _, _ int) ([]api.SavedTrack, error)
- func (m *MockLibrary) PlaylistTracks(_ context.Context, _ string, _, _ int) ([]api.Track, int, bool, error)
- func (m *MockLibrary) Playlists(_ context.Context, _, _ int) ([]api.SimplePlaylist, error)
- func (m *MockLibrary) RecentlyPlayed(_ context.Context, _ int) ([]api.PlayHistory, error)
- func (m *MockLibrary) SavedAlbums(_ context.Context, _, _ int) ([]api.SavedAlbum, error)
- func (m *MockLibrary) UnlikeTrack(_ context.Context, _ string) error
- type MockPlayer
- func (m *MockPlayer) AddToQueue(_ context.Context, _ string) error
- func (m *MockPlayer) Next(_ context.Context) error
- func (m *MockPlayer) Pause(_ context.Context) error
- func (m *MockPlayer) Play(_ context.Context, _ api.PlayOptions) error
- func (m *MockPlayer) PlaybackState(_ context.Context) (*api.PlaybackState, error)
- func (m *MockPlayer) Previous(_ context.Context) error
- func (m *MockPlayer) Queue(_ context.Context) (*api.QueueResponse, error)
- func (m *MockPlayer) Seek(_ context.Context, _ int) error
- func (m *MockPlayer) SetRepeat(_ context.Context, _ string) error
- func (m *MockPlayer) SetShuffle(_ context.Context, _ bool) error
- func (m *MockPlayer) SetVolume(_ context.Context, _ int) error
- type MockPlaylists
- func (m *MockPlaylists) AddTracksToPlaylist(_ context.Context, _ string, _ []string) error
- func (m *MockPlaylists) CreatePlaylist(_ context.Context, _, _ string, _ bool) (*api.SimplePlaylist, error)
- func (m *MockPlaylists) RemoveTracksFromPlaylist(_ context.Context, _ string, _ []string) error
- func (m *MockPlaylists) ReorderPlaylistTracks(_ context.Context, _ string, _, _, _ int) error
- func (m *MockPlaylists) UpdatePlaylist(_ context.Context, _, _, _ string) error
- type MockSearch
- type MockUser
- func (m *MockUser) Profile(_ context.Context) (api.UserProfile, error)
- func (m *MockUser) RecentlyPlayed(_ context.Context, _ int) ([]api.PlayHistory, error)
- func (m *MockUser) TopArtists(_ context.Context, _ string, _ int) ([]api.FullArtist, error)
- func (m *MockUser) TopTracks(_ context.Context, _ string, _ int) ([]api.Track, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MockDevices ¶
type MockDevices struct {
DevicesResult []api.Device
DevicesErr error
TransferErr error
TransferPlaybackCalled bool
}
MockDevices is a test double for DevicesAPI.
func (*MockDevices) TransferPlayback ¶
TransferPlayback records the call and returns the configured error.
type MockLibrary ¶
type MockLibrary struct {
PlaylistsResult []api.SimplePlaylist
PlaylistsErr error
PlaylistTracksResult []api.Track
PlaylistTracksTotal int
PlaylistTracksHasNext bool
PlaylistTracksErr error
AlbumTracksResult []api.Track
AlbumTracksHasNext bool
AlbumTracksErr error
SavedAlbumsResult []api.SavedAlbum
SavedAlbumsErr error
LikedTracksResult []api.SavedTrack
LikedTracksErr error
RecentlyPlayedResult []api.PlayHistory
RecentlyPlayedErr error
LikeErr error
UnlikeErr error
LikeTrackCalled bool
UnlikeTrackCalled bool
}
MockLibrary is a test double for LibraryAPI.
func (*MockLibrary) AlbumTracks ¶
AlbumTracks returns the configured result, hasNext, and error.
func (*MockLibrary) GetPlaylist ¶
GetPlaylist returns the configured result, total, hasNext, and error. Delegates to the same PlaylistTracks fields for simplicity in tests.
func (*MockLibrary) LikeTrack ¶
func (m *MockLibrary) LikeTrack(_ context.Context, _ string) error
LikeTrack records the call and returns the configured error.
func (*MockLibrary) LikedTracks ¶
func (m *MockLibrary) LikedTracks(_ context.Context, _, _ int) ([]api.SavedTrack, error)
LikedTracks returns the configured result and error.
func (*MockLibrary) PlaylistTracks ¶
func (m *MockLibrary) PlaylistTracks(_ context.Context, _ string, _, _ int) ([]api.Track, int, bool, error)
PlaylistTracks returns the configured result, total, hasNext, and error.
func (*MockLibrary) Playlists ¶
func (m *MockLibrary) Playlists(_ context.Context, _, _ int) ([]api.SimplePlaylist, error)
Playlists returns the configured result and error.
func (*MockLibrary) RecentlyPlayed ¶
func (m *MockLibrary) RecentlyPlayed(_ context.Context, _ int) ([]api.PlayHistory, error)
RecentlyPlayed returns the configured result and error.
func (*MockLibrary) SavedAlbums ¶
func (m *MockLibrary) SavedAlbums(_ context.Context, _, _ int) ([]api.SavedAlbum, error)
SavedAlbums returns the configured result and error.
func (*MockLibrary) UnlikeTrack ¶
func (m *MockLibrary) UnlikeTrack(_ context.Context, _ string) error
UnlikeTrack records the call and returns the configured error.
type MockPlayer ¶
type MockPlayer struct {
PlaybackStateResult *api.PlaybackState
PlaybackStateErr error
PlayErr error
PauseErr error
NextErr error
PreviousErr error
SeekErr error
SetVolumeErr error
SetShuffleErr error
SetRepeatErr error
AddToQueueErr error
QueueResult *api.QueueResponse
QueueErr error
PlayCalled bool
PauseCalled bool
NextCalled bool
PreviousCalled bool
SeekCalled bool
SetVolumeCalled bool
SetShuffleCalled bool
SetRepeatCalled bool
AddToQueueCalled bool
}
MockPlayer is a test double for PlayerAPI. Set the Result/Err fields before calling the method to control behavior. Called booleans record whether mutating methods were invoked.
func (*MockPlayer) AddToQueue ¶
func (m *MockPlayer) AddToQueue(_ context.Context, _ string) error
AddToQueue records the call and returns the configured error.
func (*MockPlayer) Next ¶
func (m *MockPlayer) Next(_ context.Context) error
Next records the call and returns the configured error.
func (*MockPlayer) Pause ¶
func (m *MockPlayer) Pause(_ context.Context) error
Pause records the call and returns the configured error.
func (*MockPlayer) Play ¶
func (m *MockPlayer) Play(_ context.Context, _ api.PlayOptions) error
Play records the call and returns the configured error.
func (*MockPlayer) PlaybackState ¶
func (m *MockPlayer) PlaybackState(_ context.Context) (*api.PlaybackState, error)
PlaybackState returns the configured PlaybackStateResult and error.
func (*MockPlayer) Previous ¶
func (m *MockPlayer) Previous(_ context.Context) error
Previous records the call and returns the configured error.
func (*MockPlayer) Queue ¶
func (m *MockPlayer) Queue(_ context.Context) (*api.QueueResponse, error)
Queue returns the configured QueueResult and error.
func (*MockPlayer) Seek ¶
func (m *MockPlayer) Seek(_ context.Context, _ int) error
Seek records the call and returns the configured error.
func (*MockPlayer) SetRepeat ¶
func (m *MockPlayer) SetRepeat(_ context.Context, _ string) error
SetRepeat records the call and returns the configured error.
func (*MockPlayer) SetShuffle ¶
func (m *MockPlayer) SetShuffle(_ context.Context, _ bool) error
SetShuffle records the call and returns the configured error.
type MockPlaylists ¶
type MockPlaylists struct {
CreateResult *api.SimplePlaylist
CreateErr error
UpdateErr error
AddTracksErr error
RemoveTracksErr error
ReorderErr error
CreatePlaylistCalled bool
UpdatePlaylistCalled bool
}
MockPlaylists is a test double for PlaylistsAPI.
func (*MockPlaylists) AddTracksToPlaylist ¶
AddTracksToPlaylist returns the configured error.
func (*MockPlaylists) CreatePlaylist ¶
func (m *MockPlaylists) CreatePlaylist(_ context.Context, _, _ string, _ bool) (*api.SimplePlaylist, error)
CreatePlaylist records the call and returns the configured result and error.
func (*MockPlaylists) RemoveTracksFromPlaylist ¶
RemoveTracksFromPlaylist returns the configured error.
func (*MockPlaylists) ReorderPlaylistTracks ¶
ReorderPlaylistTracks returns the configured error.
func (*MockPlaylists) UpdatePlaylist ¶
func (m *MockPlaylists) UpdatePlaylist(_ context.Context, _, _, _ string) error
UpdatePlaylist records the call and returns the configured error.
type MockSearch ¶
type MockSearch struct {
SearchResult *api.SearchResult
SearchErr error
}
MockSearch is a test double for SearchAPI.
type MockUser ¶
type MockUser struct {
ProfileResult api.UserProfile
ProfileErr error
TopTracksResult []api.Track
TopTracksErr error
TopArtistsResult []api.FullArtist
TopArtistsErr error
RecentlyPlayedResult []api.PlayHistory
RecentlyPlayedErr error
}
MockUser is a test double for UserAPI.
func (*MockUser) RecentlyPlayed ¶
RecentlyPlayed returns the configured result and error.
func (*MockUser) TopArtists ¶
TopArtists returns the configured result and error.