import { afterEach, describe, expect, test, vi } from 'vitest'; vi.mock('./client', () => ({ api: { get: vi.fn() } })); import { listAlbumsAlpha } from './albums'; import { qk } from './queries'; import { api } from './client'; afterEach(() => vi.clearAllMocks()); describe('albums client', () => { test('listAlbumsAlpha hits /api/library/albums with paging', async () => { (api.get as ReturnType).mockResolvedValueOnce({ items: [], total: 0, limit: 50, offset: 0 }); await listAlbumsAlpha(50, 0); expect(api.get).toHaveBeenCalledWith('/api/library/albums?limit=50&offset=0'); }); test('listAlbumsAlpha honors custom limit and offset', async () => { (api.get as ReturnType).mockResolvedValueOnce({ items: [], total: 0, limit: 25, offset: 100 }); await listAlbumsAlpha(25, 100); expect(api.get).toHaveBeenCalledWith('/api/library/albums?limit=25&offset=100'); }); test('qk.albumsAlpha key is stable', () => { expect(qk.albumsAlpha()).toEqual(['albumsAlpha']); }); });