Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
test('MusicPlayerService | playPrev and isPlaying and currentIndex does not change | takes no effect', () => {
let setNowPlayingConfig = {
color: 'some color',
notificationIcon: 'notificationIcon'
}
let musicPlayerService = new MusicPlayerService(true, setNowPlayingConfig);
let newQueue = [new Track({ id: '2', path: 'some path' })];
MusicControl._releaseTrack = jest.fn();
MusicControl._setNowPlaying = jest.fn();
MusicControl._onNext = jest.fn();
MusicControl._playTrack = jest.fn();
expect.assertions(4);
return musicPlayerService.setQueue(newQueue)
.then(() => {
musicPlayerService.isPlaying = true;
musicPlayerService.playPrev();
expect(MusicControl._releaseTrack).not.toHaveBeenCalled();
expect(MusicControl._setNowPlaying).not.toHaveBeenCalled();
expect(MusicControl._onNext).not.toHaveBeenCalled();
expect(MusicControl._playTrack).not.toHaveBeenCalled();
});
});