teqo-backup/tests/unit/onda0ConsentTexts.unit.spec.ts
Francisco Ignácio Fontoura Solla cc66ec3c31 Deliver Onda 0 MVP: provisional Consent, privacy policy, and /privacidade.
Auto-provision legal texts via migrations and db:seed:consent so local and
production deploy stay fail-closed-ready; register O0+ simplify follow-ups.
2026-07-19 03:38:21 -03:00

29 lines
948 B
TypeScript

import { describe, expect, it } from 'vitest'
import {
ONDA0_CONSENT_ENTRIES,
ONDA0_CONSENT_KEY_LIST,
ONDA0_PRIVACY_POLICY_BODY,
ONDA0_PROVISIONAL_BANNER,
} from '@/lib/onda0ConsentTexts'
describe('onda0ConsentTexts', () => {
it('includes the provisional banner in every consent and privacy body', () => {
for (const { text } of ONDA0_CONSENT_ENTRIES) {
expect(text.root.children[0]?.children[0]).toMatchObject({ text: ONDA0_PROVISIONAL_BANNER })
}
expect(ONDA0_PRIVACY_POLICY_BODY.root.children[0]?.children[0]).toMatchObject({
text: ONDA0_PROVISIONAL_BANNER,
})
})
it('defines all four stable keys', () => {
expect(ONDA0_CONSENT_ENTRIES.map((entry) => entry.key)).toEqual(ONDA0_CONSENT_KEY_LIST)
})
it('builds multi-paragraph lexical roots for each consent', () => {
for (const { text } of ONDA0_CONSENT_ENTRIES) {
expect(text.root.children.length).toBeGreaterThan(3)
}
})
})