admin/lib/notificationTemplate.test.ts
alisaza e1eaf5eff5 feat: initial ghabilee-admin backoffice app
Extract admin dashboard from ghabilee-frontend2 into a dedicated Next.js
app for backoffice.ghabilee.ir (no SEO indexing / Clarity).
2026-09-05 13:12:59 +03:30

18 lines
757 B
TypeScript

import { describe, expect, it } from 'vitest'
import { renderNotificationActionUrlPreview, renderNotificationTemplate } from '@/lib/notificationTemplate'
describe('notification template preview', () => {
it('substitutes sample variables and leaves unknown placeholders visible', () => {
expect(
renderNotificationTemplate('رزرو شما برای «{{eventTitle}}» تأیید شد {{missing}}', {
eventTitle: 'دورهمی آخر هفته',
})
).toBe('رزرو شما برای «دورهمی آخر هفته» تأیید شد {{missing}}')
})
it('encodes action URL sample values', () => {
expect(renderNotificationActionUrlPreview('/bookings/{{bookingId}}', { bookingId: 'a/b' })).toBe('/bookings/a%2Fb')
})
})