'use strict'; const assert = require('assert'); const fs = require('fs'); const path = require('path'); const root = path.join(__dirname, '..'); const operations = fs.readFileSync(path.join(root, 'src/routes/operations.js'), 'utf8'); const worker = fs.readFileSync(path.join(root, 'src/workers/task_runner.js'), 'utf8'); const app = fs.readFileSync(path.join(root, 'public/app.js'), 'utf8'); const html = fs.readFileSync(path.join(root, 'public/index.html'), 'utf8'); assert(operations.includes("router.post('/pause/:taskId'"), '缺少暂停接口'); assert(operations.includes("router.post('/resume/:taskId'"), '缺少继续接口'); assert(operations.includes('paused: !!task.paused'), '任务查询必须返回暂停状态'); assert(worker.includes("msg.type === 'pause'"), 'Worker 必须接收暂停信号'); assert(worker.includes('waitUntilReady: waitWhilePaused'), '并发队列必须在领取账号前等待继续'); assert(app.includes('async togglePauseTask()'), '前端缺少暂停/继续操作'); assert(app.includes("data.type === 'task_state'"), '前端必须接收实时暂停状态'); assert(html.includes('x-text="isPaused ? \'继续\' : \'暂停\'"'), '页面缺少暂停/继续按钮'); console.log('task_pause_feature.test.js: PASS');