update nitro player mocks

This commit is contained in:
Violet Caulfield
2026-02-21 00:50:49 -06:00
parent 09c8a4714d
commit 2f16a86454
+39 -5
View File
@@ -1,11 +1,45 @@
jest.mock('react-native-nitro-player', () => ({
TrackPlayer: jest.fn().mockImplementation(() => ({
TrackPlayer: {
configure: jest.fn(),
play: jest.fn(),
pause: jest.fn(),
stop: jest.fn(),
configure: jest.fn(),
onChangeTrack: jest.fn(),
seek: jest.fn(),
skipToIndex: jest.fn(),
skipToNext: jest.fn(),
skipToPrevious: jest.fn(),
})),
onChangeTrack: jest.fn(),
onPlaybackProgressChange: jest.fn(),
onPlaybackStateChange: jest.fn(),
setRepeatMode: jest.fn(),
},
PlayerQueue: {
getCurrentPlaylist: jest.fn(),
getPlaylist: jest.fn(),
createPlaylist: jest.fn(),
addTracksToPlaylist: jest.fn(),
reorderTrackInPlaylist: jest.fn(),
},
DownloadManager: {
downloadTrack: jest.fn(),
deleteTrack: jest.fn(),
getDownloadedTracks: jest.fn().mockResolvedValue([]),
isTrackDownloaded: jest.fn().mockReturnValue(false),
},
RepeatMode: {
None: 'none',
One: 'one',
All: 'all',
},
TrackPlayerState: {
Playing: 'playing',
Paused: 'paused',
Stopped: 'stopped',
Buffering: 'buffering',
None: 'none',
},
useNowPlaying: jest.fn().mockReturnValue({ nowPlaying: undefined }),
useOnPlaybackProgressChange: jest.fn().mockReturnValue({ position: 0, totalDuration: 0 }),
useOnPlaybackStateChange: jest.fn().mockReturnValue({ state: 'none' }),
useDownloadProgress: jest.fn().mockReturnValue({ progress: 0 }),
useDownloadedTracks: jest.fn().mockReturnValue({ downloadedTracks: [] }),
}))