diff --git a/web/src/lib/api/playlists.test.ts b/web/src/lib/api/playlists.test.ts index 209f9ae8..4fe7f464 100644 --- a/web/src/lib/api/playlists.test.ts +++ b/web/src/lib/api/playlists.test.ts @@ -22,16 +22,23 @@ afterEach(() => { }); describe('playlists API helper', () => { - test('listPlaylists GETs /api/playlists', async () => { + test('listPlaylists GETs /api/playlists with default kind=user', async () => { const spy = stubFetch(200, { owned: [], public: [] }); const r = await listPlaylists(); expect(r.owned).toEqual([]); expect(r.public).toEqual([]); const call = spy.mock.calls[0]; - expect(call[0]).toBe('/api/playlists'); + expect(call[0]).toBe('/api/playlists?kind=user'); expect((call[1] as RequestInit).method).toBe('GET'); }); + test('listPlaylists passes kind=system through the query string', async () => { + const spy = stubFetch(200, { owned: [], public: [] }); + await listPlaylists('system'); + const call = spy.mock.calls[0]; + expect(call[0]).toBe('/api/playlists?kind=system'); + }); + test('createPlaylist POSTs JSON body', async () => { const spy = stubFetch(200, { id: 'p1', name: 'Test' }); const r = await createPlaylist({ name: 'Test' });