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 | tooglePlayPause when is not playing and play is called | playNext is called after track finishes', () => {
let musicPlayerService = new MusicPlayerService();
let newQueue = [new Track({ id: '2', path: 'some path' })];
musicPlayerService.playNext = jest.fn();
Sound.mockSetOptions({ callCallbackAfterPlay: true });
expect.assertions(1);
return musicPlayerService.setQueue(newQueue)
.then(returnedQueue => {
return musicPlayerService.togglePlayPause()
})
.then(() => {
expect(musicPlayerService.playNext).toHaveBeenCalledTimes(1);
});
});