How to use the react-native-music-control._setNowPlaying function in react-native-music-control

To help you get started, we’ve selected a few react-native-music-control 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 | 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();
    });
});