gongxiangp2/lib/__tests__/material-permanent-delete-disabled.test.ts
chenpei 7326e273e1 fix: harden media upload and release safety
Protect upload cleanup and atomic completion paths, add durable media worker leases and brand asset validation, and introduce verified migration/bootstrap/deployment gates.
2026-08-12 18:04:08 +08:00

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(')
})
})