Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion api/src/__tests__/email-service.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getEmailServiceStatus, initializeEmailService, escapeHtml } from '../shared/email-service'
import { getEmailServiceStatus, initializeEmailService, escapeHtml, generateOrganizerEmailContent } from '../shared/email-service'

// Mock the EmailClient
jest.mock('@azure/communication-email', () => ({
Expand Down Expand Up @@ -108,4 +108,25 @@ describe('Email Service', () => {
expect(escapeHtml('')).toBe('')
})
})

describe('Vietnamese language support', () => {
it('should gracefully fallback to English email copy for unsupported Vietnamese templates', () => {
const game = {
code: '123456',
name: 'Holiday Exchange',
date: '2026-12-24',
location: 'Main Office',
amount: '20',
organizerToken: 'org-token',
participants: [{ id: '1' }, { id: '2' }, { id: '3' }]
} as any

const viContent = generateOrganizerEmailContent({ game, language: 'vi' })
const enContent = generateOrganizerEmailContent({ game, language: 'en' })

expect(viContent.subject).toBe(enContent.subject)
expect(viContent.html).toBe(enContent.html)
expect(viContent.plainText).toBe(enContent.plainText)
})
})
})
Loading
Loading