import { buildProjectChronicleGuardContext, ProjectProfile } from '../src/features/projectChronicle';

const profile: ProjectProfile = {
    projectId: 'connectai',
    projectName: 'ConnectAI',
    projectRoot: '/workspace/ConnectAI',
    recordRoot: '/workspace/ConnectAI/docs/records/ConnectAI',
    description: 'Local AI assistant',
    corePurpose: 'Keep project knowledge traceable.',
    detailLevel: 'standard',
    createdAt: '2026-05-02T00:00:00.000Z',
    updatedAt: '2026-05-02T00:00:00.000Z'
};

describe('buildProjectChronicleGuardContext', () => {
    it('requires project checks, question reasons, MVP-first scope, and candidate records', () => {
        const context = buildProjectChronicleGuardContext(profile);

        expect(context).toContain('Project selection status: selected');
        expect(context).toContain('Short conclusion first');
        expect(context).toContain('Brief summary');
        expect(context).toContain('one compact paragraph by default');
        expect(context).toContain('Detailed answer');
        expect(context).toContain('Avoid bullet-heavy formatting');
        expect(context).toContain('Use visible markdown headings');
        expect(context).toContain('No Evidence, No Project Claim');
        expect(context).toContain('confirmed facts, inferences, general knowledge, and needs verification');
        expect(context).toContain('현재 정보만으로는 기술 구조를 판단할 수 없습니다');
        expect(context).toContain('technically stable');
        expect(context).toContain('approval likelihood');
        expect(context).toContain('confirmed facts, inference, general UX/business principle, needs verification, recommended direction');
        expect(context).toContain('Project record target check');
        expect(context).toContain('Record path check');
        expect(context).toContain('Question reason');
        expect(context).toContain('Recommend a low-dependency MVP first');
        expect(context).toContain('Later expansion');
        expect(context).toContain('Candidate records for this discussion');
        expect(context).toContain('Do not mark a decision as accepted until the user confirms it');
        expect(context).toContain('Guard and MA/Multi-Agent');
        expect(context).toContain('policy/context layer');
        expect(context).toContain('execution strategy');
        expect(context).toContain('Markdown, JSON, local files');
    });

    it('handles missing project context explicitly', () => {
        const context = buildProjectChronicleGuardContext(null);

        expect(context).toContain('Project selection status: not selected');
        expect(context).toContain('existing project, create a new project, or skip recording');
        expect(context).toContain('must be described but not written');
    });
});
