teqo-backup/tests/unit/notificationContract.unit.spec.ts
Cursor Agent de67acf41b D2 — Push + sino in-app para /campanha
- Collections Notification e PushSubscription com migration
- Sino no header (mobile + desktop) com drawer de avisos lidos/não lidos
- Hooks em municipalityUpdate, supporter, activity e convite aceito
- Push Web via web-push + handlers no service worker /campanha/sw.js
- Opt-in LGPD em /campanha/perfil (chave campanha-notificacoes-push)
- Testes unit/int de contrato e access

Co-authored-by: Francisco Solla <fsolla@users.noreply.github.com>
2026-07-31 01:51:41 +00:00

20 lines
736 B
TypeScript

import { describe, expect, it } from 'vitest'
import { notificationTypeLabels, notificationTypes } from '@/lib/notificationContract'
import { buildCampaignServiceWorkerScript } from '@/utilities/campaignPwa'
describe('notificationContract', () => {
it('labels every notification type', () => {
for (const type of notificationTypes) {
expect(notificationTypeLabels[type]).toBeTruthy()
}
})
})
describe('buildCampaignServiceWorkerScript', () => {
it('includes push and notificationclick handlers', () => {
const script = buildCampaignServiceWorkerScript('test-build')
expect(script).toContain("self.addEventListener('push'")
expect(script).toContain("self.addEventListener('notificationclick'")
})
})