gongxiangp2/app/page.video-transcode-poll.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

22 lines
870 B
TypeScript

import { readFileSync } from 'fs'
import path from 'path'
describe('首页视频转码状态轮询边界', () => {
test('轮询只读状态,不得静默触发强制重试写请求', () => {
const source = readFileSync(path.join(process.cwd(), 'app/page.tsx'), 'utf8')
const pollBody = source.split('const poll = async () => {')[1]?.split('// 标记为正在轮询')[0]
expect(pollBody).toBeTruthy()
expect(pollBody).not.toContain("method: 'POST'")
expect(pollBody).not.toContain('forceRetry')
})
test('不能用固定30分钟上限停止仍在排队或处理中的视频', () => {
const source = readFileSync(path.join(process.cwd(), 'app/page.tsx'), 'utf8')
expect(source).not.toContain('30 * 60 * 1000')
expect(source).not.toContain('transcodeStartTimes')
expect(source).toContain('done/failed 会主动停止')
})
})