mirror of
https://github.com/Awuqing/BackupX.git
synced 2026-06-25 19:43:41 +08:00
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)
|
|
})
|
|
})
|