fix(web/m7-352): update listPlaylists test URL after kind filter addition
This commit is contained in:
@@ -22,16 +22,23 @@ afterEach(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('playlists API helper', () => {
|
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 spy = stubFetch(200, { owned: [], public: [] });
|
||||||
const r = await listPlaylists();
|
const r = await listPlaylists();
|
||||||
expect(r.owned).toEqual([]);
|
expect(r.owned).toEqual([]);
|
||||||
expect(r.public).toEqual([]);
|
expect(r.public).toEqual([]);
|
||||||
const call = spy.mock.calls[0];
|
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');
|
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 () => {
|
test('createPlaylist POSTs JSON body', async () => {
|
||||||
const spy = stubFetch(200, { id: 'p1', name: 'Test' });
|
const spy = stubFetch(200, { id: 'p1', name: 'Test' });
|
||||||
const r = await createPlaylist({ name: 'Test' });
|
const r = await createPlaylist({ name: 'Test' });
|
||||||
|
|||||||
Reference in New Issue
Block a user