Protect upload cleanup and atomic completion paths, add durable media worker leases and brand asset validation, and introduce verified migration/bootstrap/deployment gates.
19 lines
677 B
TypeScript
19 lines
677 B
TypeScript
/** @jest-environment node */
|
|
|
|
import { readFile } from 'fs/promises'
|
|
import path from 'path'
|
|
|
|
describe('material permanent delete safety gate', () => {
|
|
test.each([
|
|
'app/api/materials/route.ts',
|
|
'app/api/admin/materials/batch-delete/route.ts',
|
|
])('%s 在持久化 purge/outbox 上线前禁止物理删除', async (relativePath) => {
|
|
const source = await readFile(path.join(process.cwd(), relativePath), 'utf8')
|
|
|
|
expect(source).toContain("code: 'PERMANENT_DELETE_DISABLED'")
|
|
expect(source).not.toContain('deleteFiles(')
|
|
expect(source).not.toContain('deleteMaterialRelatedRecords(')
|
|
expect(source).not.toContain('prisma.material.delete(')
|
|
})
|
|
})
|