1. 排行榜悬浮窗关闭后小按钮消失问题 - 修复面板居中模式关闭时按钮位置错误 - 保存并恢复按钮的居中状态 2. 首页tag按钮按素材数量排序 - 添加按素材数量降序排序逻辑 3. 上传弹窗输入框浅色模式文字不可见 - 添加 text-slate-900 确保浅色模式下文字可见 - 添加 placeholder 样式确保占位符正确显示
107 lines
3.4 KiB
TypeScript
107 lines
3.4 KiB
TypeScript
/**
|
|
* 模板迁移测试
|
|
*
|
|
* **Feature: bugfix-dec-2025**
|
|
* **Property 6: AI模板移除后素材迁移**
|
|
* **Validates: Requirements 6.1, 6.2**
|
|
*
|
|
* @jest-environment node
|
|
*/
|
|
|
|
import {
|
|
BUILTIN_TEMPLATE_KEYS,
|
|
BUILTIN_TEMPLATE_NAMES,
|
|
BUILTIN_TEMPLATE_TYPES,
|
|
BUILTIN_TEMPLATE_KINDS,
|
|
} from '@/lib/upload-template-presets'
|
|
|
|
describe('模板配置验证', () => {
|
|
/**
|
|
* Property 6: AI模板移除验证
|
|
* *For any* 内置模板配置,不应包含 ai-material
|
|
* **Feature: bugfix-dec-2025, Property 6: AI模板移除后素材迁移**
|
|
* **Validates: Requirements 6.1**
|
|
*/
|
|
describe('Property 6: AI模板移除验证', () => {
|
|
it('BUILTIN_TEMPLATE_KEYS 不应包含 ai-material', () => {
|
|
expect(BUILTIN_TEMPLATE_KEYS).not.toContain('ai-material')
|
|
})
|
|
|
|
it('BUILTIN_TEMPLATE_NAMES 不应包含 ai-material', () => {
|
|
expect(Object.keys(BUILTIN_TEMPLATE_NAMES)).not.toContain('ai-material')
|
|
})
|
|
|
|
it('BUILTIN_TEMPLATE_TYPES 不应包含 ai-material', () => {
|
|
expect(Object.keys(BUILTIN_TEMPLATE_TYPES)).not.toContain('ai-material')
|
|
})
|
|
|
|
it('BUILTIN_TEMPLATE_KINDS 不应包含 ai-material', () => {
|
|
expect(Object.keys(BUILTIN_TEMPLATE_KINDS)).not.toContain('ai-material')
|
|
})
|
|
})
|
|
|
|
/**
|
|
* Property 7: 音频模板添加验证
|
|
* *For any* 内置模板配置,应包含 audio-material
|
|
* **Feature: bugfix-dec-2025, Property 7: 音频模板添加验证**
|
|
* **Validates: Requirements 7.1**
|
|
*/
|
|
describe('Property 7: 音频模板添加验证', () => {
|
|
it('BUILTIN_TEMPLATE_KEYS 应包含 audio-material', () => {
|
|
expect(BUILTIN_TEMPLATE_KEYS).toContain('audio-material')
|
|
})
|
|
|
|
it('BUILTIN_TEMPLATE_NAMES 应包含 audio-material', () => {
|
|
expect(Object.keys(BUILTIN_TEMPLATE_NAMES)).toContain('audio-material')
|
|
expect(BUILTIN_TEMPLATE_NAMES['audio-material']).toBe('音频素材模板')
|
|
})
|
|
|
|
it('BUILTIN_TEMPLATE_TYPES 应包含 audio-material', () => {
|
|
expect(Object.keys(BUILTIN_TEMPLATE_TYPES)).toContain('audio-material')
|
|
expect(BUILTIN_TEMPLATE_TYPES['audio-material']).toBe('音频')
|
|
})
|
|
|
|
it('BUILTIN_TEMPLATE_KINDS 应包含 audio-material 且类型为 AUDIO', () => {
|
|
expect(Object.keys(BUILTIN_TEMPLATE_KINDS)).toContain('audio-material')
|
|
expect(BUILTIN_TEMPLATE_KINDS['audio-material']).toBe('AUDIO')
|
|
})
|
|
})
|
|
|
|
/**
|
|
* 模板数量验证
|
|
*/
|
|
describe('模板数量验证', () => {
|
|
it('应该有6个内置模板', () => {
|
|
expect(BUILTIN_TEMPLATE_KEYS).toHaveLength(6)
|
|
})
|
|
|
|
it('所有配置对象应该有相同数量的键', () => {
|
|
const keyCount = BUILTIN_TEMPLATE_KEYS.length
|
|
expect(Object.keys(BUILTIN_TEMPLATE_NAMES)).toHaveLength(keyCount)
|
|
expect(Object.keys(BUILTIN_TEMPLATE_TYPES)).toHaveLength(keyCount)
|
|
expect(Object.keys(BUILTIN_TEMPLATE_KINDS)).toHaveLength(keyCount)
|
|
})
|
|
})
|
|
})
|
|
|
|
describe('素材迁移逻辑', () => {
|
|
/**
|
|
* 迁移逻辑验证
|
|
*/
|
|
describe('迁移目标验证', () => {
|
|
it('ai-material 素材应该迁移到 other-material', () => {
|
|
const targetTemplate = 'other-material'
|
|
|
|
// 验证目标模板存在
|
|
expect(BUILTIN_TEMPLATE_KEYS).toContain(targetTemplate)
|
|
// 验证源模板已移除
|
|
expect(BUILTIN_TEMPLATE_KEYS).not.toContain('ai-material')
|
|
})
|
|
|
|
it('迁移后素材类型应该变为"其他"', () => {
|
|
const targetType = BUILTIN_TEMPLATE_TYPES['other-material']
|
|
expect(targetType).toBe('其他')
|
|
})
|
|
})
|
|
})
|