import { describe, expect, it } from 'vitest';
import { applyDeterministicBrandFixes, needsAiBrandFix, runDeterministicBrandFix, } from '../../ai/brand-voice-fix.js';
import { defaultStructuredProfile } from '../../ai/brand-voice-structured.js';
describe('brand-voice-fix', () => {
    it('replaces banned terms and removes forbidden exclamation points', () => {
        const structured = defaultStructuredProfile();
        structured.bannedTerms = [{ term: 'synergy', useInstead: 'collaboration' }];
        structured.mechanics.exclamationPoints = 'forbid';
        const { text, fixes } = applyDeterministicBrandFixes('Unlock synergy now!', structured);
        expect(text).toContain('collaboration');
        expect(text).not.toContain('!');
        expect(fixes.length).toBeGreaterThan(0);
    });
    it('improves score after deterministic fixes', () => {
        const structured = defaultStructuredProfile();
        structured.bannedTerms = [{ term: 'synergy', useInstead: 'collaboration' }];
        const outcome = runDeterministicBrandFix('Our synergy is unmatched.', structured);
        expect(outcome.afterScore.score).toBeGreaterThanOrEqual(outcome.beforeScore.score);
        expect(outcome.text).toContain('collaboration');
    });
    it('flags when AI fix may still be needed', () => {
        expect(needsAiBrandFix({
            score: 72,
            issues: [{ id: 'tone', severity: 'warning', message: 'Off-brand tone.' }],
            dimensions: [],
        })).toBe(true);
        expect(needsAiBrandFix({
            score: 95,
            issues: [],
            dimensions: [],
        })).toBe(false);
    });
});
//# sourceMappingURL=brand-voice-fix.test.js.map