feat(web): add home/albums/artists API clients for M6a

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-01 20:13:49 -04:00
parent b1f2227d62
commit e674869e06
6 changed files with 145 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
import { afterEach, describe, expect, test, vi } from 'vitest';
vi.mock('./client', () => ({
api: { get: vi.fn() }
}));
import { listArtistTracks } from './artists';
import { qk } from './queries';
import { api } from './client';
afterEach(() => vi.clearAllMocks());
describe('artists client', () => {
test('listArtistTracks hits /api/artists/:id/tracks', async () => {
(api.get as ReturnType<typeof vi.fn>).mockResolvedValueOnce([]);
await listArtistTracks('art-1');
expect(api.get).toHaveBeenCalledWith('/api/artists/art-1/tracks');
});
test('qk.artistTracks key includes the artist id', () => {
expect(qk.artistTracks('art-1')).toEqual(['artistTracks', 'art-1']);
});
});