fix(web/test): update playlist API tests for api.* call surface (#375)

After e8eff1b migrated playlists.ts from raw apiFetch to the api.*
wrapper, three test files mocked the wrong surface:

- playlists.test.ts: GET case asserted init.method === 'GET' but
  api.get omits init.method entirely (fetch defaults to GET). Fall
  back to 'GET' when init.method is undefined.
- playlists.refresh-discover.test.ts: re-mock ./client to expose
  `api: { post: vi.fn() }` instead of `apiFetch`; assertions check
  api.post call args.
- playlists.refresh-foryou.test.ts: same.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-10 15:48:04 -04:00
co-authored by Claude Opus 4.7
parent 2ec54bc429
commit 993bcc6a14
3 changed files with 12 additions and 17 deletions
+2 -1
View File
@@ -29,7 +29,8 @@ describe('playlists API helper', () => {
expect(r.public).toEqual([]);
const call = spy.mock.calls[0];
expect(call[0]).toBe('/api/playlists?kind=user');
expect((call[1] as RequestInit).method).toBe('GET');
// GET is fetch's default method; api.get omits init.method entirely.
expect((call[1] as RequestInit | undefined)?.method ?? 'GET').toBe('GET');
});
test('listPlaylists passes kind=system through the query string', async () => {