20 lines
900 B
TypeScript
20 lines
900 B
TypeScript
import { describe, expect, it, vi } from 'vitest';
|
|
import { AssessorApiClient } from '../../src/api/assessor-api-client';
|
|
|
|
describe('policy analysis overview API client', () => {
|
|
it('uses the encoded read-only project endpoint', async () => {
|
|
const fetcher = vi.fn<typeof fetch>().mockResolvedValue(new Response(JSON.stringify({
|
|
version: 1,
|
|
projectId: 'project/one',
|
|
generatedAt: '2026-08-04T15:00:00.000Z',
|
|
summary: {}, profiles: [], evaluations: [], reviewItems: []
|
|
}), { status: 200, headers: { 'Content-Type': 'application/json' } }));
|
|
const client = new AssessorApiClient({ fetcher });
|
|
|
|
await client.getPolicyAnalysisOverview('project/one');
|
|
|
|
expect(fetcher.mock.calls[0][0]).toBe('/api/v1/projects/project%2Fone/policy-analysis-overview');
|
|
expect(new Headers(fetcher.mock.calls[0][1]?.headers).has('X-Assessor-Request')).toBe(false);
|
|
});
|
|
});
|