import { describe, it, expect, vi, beforeEach } from 'vitest';
import { getSystemPlaylistsStatus } from './me';

vi.mock('./client', () => ({
  api: { get: vi.fn() }
}));

import { api } from './client';

describe('me API', () => {
  beforeEach(() => vi.clearAllMocks());

  it('getSystemPlaylistsStatus GETs the correct path', async () => {
    (api.get as unknown as ReturnType<typeof vi.fn>).mockResolvedValueOnce({
      in_flight: false, last_run_at: null, last_error: null
    });
    const got = await getSystemPlaylistsStatus();
    expect(api.get).toHaveBeenCalledWith('/api/me/system-playlists-status');
    expect(got.in_flight).toBe(false);
  });
});
