mirror of
https://github.com/Awuqing/BackupX.git
synced 2026-05-27 19:19:35 +08:00
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.
21 lines
971 B
TypeScript
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)
|
|
})
|
|
})
|