How to use the react-native-sound.mockSetError function in react-native-sound

To help you get started, we’ve selected a few react-native-sound examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github flarocca / react-native-music-player-service / __tests__ / src / MusicPlayerService.Tests.js View on Github external
test('MusicPlayerService | tooglePlayPause when is not playing and no track loaded and error loading track | reject is called', () => {
  let musicPlayerService = new MusicPlayerService();
  let newQueue = [new Track({ id: '2', path: 'some path' })];
  let error = 'mock error';

  Sound.mockSetError(error);

  expect.assertions(1);
  return musicPlayerService.setQueue(newQueue)
    .then(returnedQueue => {
      musicPlayerService.togglePlayPause()
    }).catch((err) => {
      expect(err).toEqual(error);
    });
});