Files
BackupX/web/src/components/notifications/field-config.test.ts
Wu Qing 63fde903d2 feat: add complete MFA support
Add complete MFA support with TOTP, recovery codes, WebAuthn, trusted-device cookie flow, and email/SMS OTP delivery via notification channels. Security follow-up: trusted device tokens are stored in HttpOnly cookies, and SMS OTP reuses the existing Webhook notifier to avoid introducing a new dynamic URL sink.
2026-04-25 22:14:50 +08:00

21 lines
971 B
TypeScript

import { describe, expect, it } from 'vitest'
import { getNotificationFieldConfigs, getNotificationTypeLabel } from './field-config'
describe('notification field config', () => {
it('returns readable type labels', () => {
expect(getNotificationTypeLabel('email')).toBe('Email')
expect(getNotificationTypeLabel('telegram')).toBe('Telegram')
expect(getNotificationTypeLabel('webhook')).toBe('Webhook')
})
it('returns required fields for each notification type', () => {
const emailFields = getNotificationFieldConfigs('email')
const webhookFields = getNotificationFieldConfigs('webhook')
const telegramFields = getNotificationFieldConfigs('telegram')
expect(emailFields.some((field) => field.key === 'host' && field.required)).toBe(true)
expect(webhookFields.some((field) => field.key === 'url' && field.required)).toBe(true)
expect(telegramFields.some((field) => field.key === 'botToken' && field.required)).toBe(true)
})
})