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']);
  });
});
