flnxi-Wu/lib/__tests__/video-transcode-queue.test.ts
2026-05-25 16:16:29 +08:00

35 lines
854 B
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

export {}
describe('video-transcode-queue', () => {
const originalEnv = process.env
afterEach(() => {
process.env = originalEnv
jest.resetModules()
})
it('无参创建单例时会读取 VIDEO_TRANSCODE_MAX_CONCURRENT', async () => {
process.env = {
...originalEnv,
VIDEO_TRANSCODE_MAX_CONCURRENT: '3',
}
jest.resetModules()
const { transcodeQueue } = await import('../video-transcode-queue')
expect(transcodeQueue.getStatus().maxConcurrent).toBe(3)
})
it('非法并发配置会回退为 1,保护低性能私有化环境', async () => {
process.env = {
...originalEnv,
VIDEO_TRANSCODE_MAX_CONCURRENT: '0',
}
jest.resetModules()
const { transcodeQueue } = await import('../video-transcode-queue')
expect(transcodeQueue.getStatus().maxConcurrent).toBe(1)
})
})