41 lines
1.4 KiB
TypeScript
41 lines
1.4 KiB
TypeScript
/**
|
|
* 任务-页面删除清理回归测试
|
|
*
|
|
* 目的:确保任务-页面类型也会进入 MaterialAsset 清理链路,
|
|
* 避免多张预览图的 S3 文件在永久删除后残留。
|
|
*/
|
|
|
|
describe('任务-页面清理覆盖测试', () => {
|
|
test('collectMaterialFiles 的任务类型列表应包含任务-页面', async () => {
|
|
const fs = require('fs')
|
|
const path = require('path')
|
|
|
|
const filePath = path.join(__dirname, '../material-cleanup.ts')
|
|
const content = fs.readFileSync(filePath, 'utf-8')
|
|
|
|
const firstTaskTypeDecl = content.match(/const taskMaterialTypes = \[[^\]]+\];/)
|
|
expect(firstTaskTypeDecl).not.toBeNull()
|
|
if (!firstTaskTypeDecl) {
|
|
throw new Error('未找到 collectMaterialFiles 的任务类型列表')
|
|
}
|
|
|
|
expect(firstTaskTypeDecl[0]).toContain("'任务-页面'")
|
|
})
|
|
|
|
test('deleteMaterialRelatedRecords 的任务类型列表应包含任务-页面', async () => {
|
|
const fs = require('fs')
|
|
const path = require('path')
|
|
|
|
const filePath = path.join(__dirname, '../material-cleanup.ts')
|
|
const content = fs.readFileSync(filePath, 'utf-8')
|
|
|
|
const allTaskTypeDecls = content.match(/const taskMaterialTypes = \[[^\]]+\];/g)
|
|
expect(allTaskTypeDecls).not.toBeNull()
|
|
if (!allTaskTypeDecls || allTaskTypeDecls.length < 2) {
|
|
throw new Error('未找到 deleteMaterialRelatedRecords 的任务类型列表')
|
|
}
|
|
|
|
expect(allTaskTypeDecls[1]).toContain("'任务-页面'")
|
|
})
|
|
})
|