Skip to content

Commit

Permalink
Add test for adding an album to an existing playlist
Browse files Browse the repository at this point in the history
  • Loading branch information
sferra committed Mar 17, 2024
1 parent 1779e34 commit b85d199
Showing 1 changed file with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,29 @@ describe('Album view container', () => {
]);
});

it('should add album tracks to an existing playlist using the album menu popup', async () => {
const { component, store } = mountComponent(
buildStoreState()
.withAlbumDetails()
.withPlaylists([{
id: 'test playlist id',
name: 'test playlist',
tracks: []
}])
.build()
);
await waitFor(() => component.getByTestId('more-button').click());
await waitFor(() => component.getByText(/Add album to playlist/i).click());
await waitFor(() => component.getByText('test playlist').click());

const state = store.getState();
expect(state.playlists.localPlaylists.data[0].tracks).toEqual([
expect.objectContaining({ uuid: 'track-1-id' }),
expect.objectContaining({ uuid: 'track-2-id' }),
expect.objectContaining({ uuid: 'track-3-id' })
]);
});

const mountComponent = mountedComponentFactory(
['/album/test-album-id'],
buildStoreState()
Expand Down

0 comments on commit b85d199

Please sign in to comment.