const test = require('node:test'); const assert = require('node:assert'); const { applyProgressEvent } = require('../src/genesis/server/static/chat_ws.js'); test('applyProgressEvent 渲染 progress 角色', () => { const got = []; applyProgressEvent({ type: 'progress', step: 'parse', detail: '完成' }, (role, text) => got.push([role, text])); assert.strictEqual(got.length, 1); assert.strictEqual(got[0][0], 'progress'); assert.ok(got[0][1].includes('parse')); }); test('applyProgressEvent 渲染 error 角色', () => { const got = []; applyProgressEvent({ type: 'error', detail: '炸了' }, (role, text) => got.push([role, text])); assert.strictEqual(got[0][0], 'error'); assert.ok(got[0][1].includes('炸了')); });