Files
Ydisks-Xianyu-Helper/frontend/smtpSettings.test.ts
T
Christ 2f20a54f30 修复前后端逻辑并完善多数据库测试
统一仪表盘、AI 回复、卡密、扫码和通知等前后端行为,补齐并发与失败恢复测试。新增 MySQL 8.4、PostgreSQL 17 持久化 Docker 功能测试和 SQLite 脱敏播种工具。
2026-07-10 14:39:13 +08:00

30 lines
1.0 KiB
TypeScript

import { describe, expect, test } from 'vitest';
import { normalizeSMTPSettings } from './smtpSettings';
describe('normalizeSMTPSettings', () => {
test('migrates a legacy sender email as the envelope address', () => {
expect(normalizeSMTPSettings({ smtp_from: '[email protected]', smtp_user: '[email protected]' })).toMatchObject({
smtp_from_name: '',
smtp_from_address: '[email protected]',
});
});
test('migrates a legacy display name and falls back to the SMTP user address', () => {
expect(normalizeSMTPSettings({ smtp_from: '闲鱼助手', smtp_user: '[email protected]' })).toMatchObject({
smtp_from_name: '闲鱼助手',
smtp_from_address: '[email protected]',
});
});
test('preserves explicit split sender fields', () => {
expect(normalizeSMTPSettings({
smtp_from: '[email protected]',
smtp_from_name: '新名称',
smtp_from_address: '[email protected]',
})).toMatchObject({
smtp_from_name: '新名称',
smtp_from_address: '[email protected]',
});
});
});