Validation of legal translations is a manual flow (user decision): copy the prompt, run it in any vendor's model, paste the answer back. The legal validation block now holds the prompt panel and a list of reviews (model, date, verdict, pasted answer, notes) instead of a model list and report link. Approval needs two distinct models whose latest complete review does not reject; a newer review supersedes a model's rejection. The locale path collector now looks through row/collapsible wrappers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
47 lines
2.0 KiB
TypeScript
47 lines
2.0 KiB
TypeScript
import { acceptingModels, validateLegalApproval } from './legal-validation'
|
|
|
|
const review = (model: string, verdict = 'approve', reviewedAt = '2026-09-29', result = '| Section | … |') => ({
|
|
model,
|
|
verdict,
|
|
reviewedAt,
|
|
result,
|
|
})
|
|
const approve = (reviews: ReturnType<typeof review>[]) =>
|
|
validateLegalApproval('approved', { siblingData: { legalValidation: { reviews } } })
|
|
|
|
describe('legal approval rule (MITHOME-113)', () => {
|
|
it('should accept two distinct models with complete, non-rejecting reviews', () => {
|
|
expect(approve([review('Claude Opus 5.5'), review('GPT-5', 'approve-with-changes')])).toBe(true)
|
|
})
|
|
|
|
it('should not count the same model twice (case- and space-insensitive)', () => {
|
|
expect(approve([review('Claude Opus 5.5'), review(' claude opus 5.5 ')])).toEqual(expect.stringContaining('Jelenleg: 1'))
|
|
})
|
|
|
|
it('should ignore incomplete reviews (no pasted answer)', () => {
|
|
expect(approve([review('Claude Opus 5.5'), review('GPT-5', 'approve', '2026-09-29', ' ')])).toEqual(expect.any(String))
|
|
})
|
|
|
|
it('should not count a model whose latest verdict is reject', () => {
|
|
expect(approve([review('Claude Opus 5.5'), review('GPT-5', 'reject')])).toEqual(expect.any(String))
|
|
})
|
|
|
|
it('should let a newer review of the same model supersede its rejection', () => {
|
|
const reviews = [review('GPT-5', 'reject', '2026-09-28'), review('GPT-5', 'approve', '2026-09-30'), review('Claude Opus 5.5')]
|
|
expect(acceptingModels({ reviews })).toEqual(['GPT-5', 'Claude Opus 5.5'])
|
|
expect(approve(reviews)).toBe(true)
|
|
})
|
|
|
|
it('should keep an older approval superseded by a newer rejection out', () => {
|
|
expect(acceptingModels({ reviews: [review('GPT-5', 'approve', '2026-09-28'), review('GPT-5', 'reject', '2026-09-30')] })).toEqual([])
|
|
})
|
|
|
|
it.each(['none', 'ai-draft', undefined])('should not require reviews for status %s', (status) => {
|
|
expect(validateLegalApproval(status, { siblingData: {} })).toBe(true)
|
|
})
|
|
|
|
it('should handle a missing record', () => {
|
|
expect(acceptingModels(undefined)).toEqual([])
|
|
})
|
|
})
|