buildLegalValidationPrompt() is the single review template: the criteria (meaning, GDPR terminology, obligation strength, preserved markers, clarity), a severity table output with a final verdict, and the Hungarian/English text of every section paired by id, missing English flagged as high severity. The legal page sidebar shows it through the LegalValidationPrompt UI field (hu + en read from REST with draft=true and no locale fallback) with copy and refresh buttons. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
41 lines
1.8 KiB
TypeScript
41 lines
1.8 KiB
TypeScript
import { buildLegalValidationPrompt, hasEnglishContent } from './legal-validation-prompt'
|
|
|
|
const hu = {
|
|
title: 'Adatvédelmi Tájékoztató',
|
|
lastUpdated: '2026. augusztus 22.',
|
|
sections: [
|
|
{ id: 'bevezetes', title: '1. Bevezetés', content: 'A mozdIT Bt. mint adatkezelő…' },
|
|
{ id: 'jogok', title: '5. Az érintettek jogai', content: 'Az érintettek bármikor…' },
|
|
],
|
|
}
|
|
const en = {
|
|
title: 'Privacy Notice',
|
|
lastUpdated: '22 August 2026',
|
|
sections: [{ id: 'bevezetes', title: '1. Introduction', content: 'mozdIT Bt., as controller…' }],
|
|
}
|
|
|
|
describe('buildLegalValidationPrompt (MITHOME-113)', () => {
|
|
const prompt = buildLegalValidationPrompt(hu, en)!
|
|
|
|
it('should include every review criterion and the output format', () => {
|
|
for (const text of ['Meaning equivalence', 'GDPR', 'Strength of obligations', 'placeholders', 'Severity (high / medium / low)', 'APPROVE WITH CHANGES', 'not legal advice']) {
|
|
expect(prompt).toContain(text)
|
|
}
|
|
})
|
|
|
|
it('should pair every Hungarian section with its English section by id', () => {
|
|
expect(prompt).toContain('--- Section 1 (bevezetes) ---\n[HU] 1. Bevezetés\nA mozdIT Bt. mint adatkezelő…\n[EN] 1. Introduction\nmozdIT Bt., as controller…')
|
|
expect(prompt).toContain('Document (EN): Privacy Notice')
|
|
})
|
|
|
|
it('should flag a missing English section as high severity', () => {
|
|
expect(prompt).toContain('--- Section 2 (jogok) ---')
|
|
expect(prompt).toMatch(/\[EN\] \(missing — report as high severity\)\n\(missing — report as high severity\)$/)
|
|
})
|
|
|
|
it('should return undefined when there is no English text', () => {
|
|
expect(buildLegalValidationPrompt(hu, { title: ' ', sections: [{ id: 'bevezetes', title: null, content: '' }] })).toBeUndefined()
|
|
expect(hasEnglishContent({})).toBe(false)
|
|
})
|
|
})
|