import { describe, it, expect } from 'vitest';
import { getTruthfulnessGuidance, type TruthfulnessMode } from './guardrails.js';

describe('guardrails', () => {
  describe('getTruthfulnessGuidance', () => {
    it('returns strict guidance for strict mode', () => {
      const guidance = getTruthfulnessGuidance('strict');
      expect(guidance).toContain('STRICT MODE');
      expect(guidance).toContain('Always tell the truth');
      expect(guidance).toContain('No lies. No invention. No fabrication.');
      expect(guidance).toContain('Tool output and user data');
    });

    it('returns standard guidance for standard mode', () => {
      const guidance = getTruthfulnessGuidance('standard');
      expect(guidance).toContain('Truthfulness Policy');
      expect(guidance).not.toContain('STRICT MODE');
      expect(guidance).toContain('actual tool output');
      expect(guidance).toContain('report the failure accurately');
    });

    it('returns relaxed guidance for relaxed mode', () => {
      const guidance = getTruthfulnessGuidance('relaxed');
      expect(guidance).toContain('Truthfulness Policy');
      expect(guidance).toContain('Be accurate');
      expect(guidance.length).toBeLessThan(getTruthfulnessGuidance('standard').length);
    });

    it('all modes return non-empty strings', () => {
      const modes: TruthfulnessMode[] = ['strict', 'standard', 'relaxed'];
      for (const mode of modes) {
        const guidance = getTruthfulnessGuidance(mode);
        expect(guidance).toBeTruthy();
        expect(guidance.trim().length).toBeGreaterThan(0);
      }
    });

    it('strict mode has the longest guidance', () => {
      const strict = getTruthfulnessGuidance('strict');
      const standard = getTruthfulnessGuidance('standard');
      const relaxed = getTruthfulnessGuidance('relaxed');

      expect(strict.length).toBeGreaterThan(standard.length);
      expect(standard.length).toBeGreaterThan(relaxed.length);
    });
  });
});
