Skip to content

Commit

Permalink
no playlist leakage
Browse files Browse the repository at this point in the history
  • Loading branch information
goto-bus-stop committed Nov 28, 2024
1 parent de18a81 commit da2911a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/playlists.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,20 @@ describe('Playlists', () => {

it('shows all playlists containing a specific media', async () => {
const token = await uw.test.createTestSessionToken(user);
const otherUser = await uw.test.createUser();

const { playlist: playlistA } = await uw.playlists.createPlaylist(user, { name: 'Playlist A' });
const { playlist: playlistB } = await uw.playlists.createPlaylist(user, { name: 'Playlist B' });
const { playlist: playlistC } = await uw.playlists.createPlaylist(otherUser, {
name: "Other user's playlist should not be included",
});

const [onlyA, onlyB, both] = await uw.source('test-source').get(user, ['ONLY_A', 'ONLY_B', 'BOTH']);
const a = await uw.playlists.addPlaylistItems(playlistA, [onlyA, both]);
const b = await uw.playlists.addPlaylistItems(playlistB, [onlyB, both]);
// All media are in playlist C, but that playlist is owned by a different user,
// so we do not expect it to show up in the assertions below.
await uw.playlists.addPlaylistItems(playlistC, [onlyA, onlyB, both]);

const mediaIDOnlyA = a.added[0].media.id;
const mediaIDOnlyB = b.added[0].media.id;
Expand Down

0 comments on commit da2911a

Please sign in to comment.