import { describe, it, expect, vi, beforeEach } from 'vitest';
import { researchMissingArt } from './admin';

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

import { api } from './client';

describe('admin research missing art API', () => {
  beforeEach(() => vi.clearAllMocks());

  it('researchMissingArt POSTs the correct path and returns version', async () => {
    (api.post as unknown as ReturnType<typeof vi.fn>).mockResolvedValueOnce({ version: 7 });
    const got = await researchMissingArt();
    expect(api.post).toHaveBeenCalledWith('/api/admin/cover-sources/research', {});
    expect(got.version).toBe(7);
  });
});
