chore: establish YCode replication baseline and TODO
This commit is contained in:
commit
6dc59f89ba
1118 files changed
+196002
No files matched your search
@@ -0,0 +1,89 @@
|
||||
import assert from 'node:assert/strict'
|
||||
import { renderToStaticMarkup } from 'react-dom/server'
|
||||
import {
|
||||
PlanCreateBlock,
|
||||
PlanUpdateBlock,
|
||||
TaskBlock,
|
||||
ThinkingBlock
|
||||
} from '../src/renderer/src/workbuddy/conversation/SpecializedBlocks'
|
||||
|
||||
const reasoning = renderToStaticMarkup(<ThinkingBlock text="Reasoning body" isFinished isLastContent />)
|
||||
assert.match(reasoning, /Reasoning body/)
|
||||
assert.match(reasoning, /思考中/)
|
||||
assert.doesNotMatch(reasoning, /<span[^>]*>[+-]<\/span>/)
|
||||
|
||||
const plan = renderToStaticMarkup(
|
||||
<PlanCreateBlock
|
||||
data={{
|
||||
id: 'plan-1', name: 'Release plan', status: 'building',
|
||||
explorationStatus: { phase: 'exploring', toolName: 'search' },
|
||||
todolist: [
|
||||
{ id: 'done', content: 'Complete step', status: 'completed' },
|
||||
{ id: 'active', content: 'Active step', status: 'in_progress' },
|
||||
{ id: 'failed', content: 'Failed step', status: 'failed' },
|
||||
{ id: 'pending', content: 'Pending step', status: 'pending' },
|
||||
{ id: 'hidden', content: 'Hidden step', status: 'pending' }
|
||||
]
|
||||
}}
|
||||
status="success"
|
||||
maxDisplayTasks={4}
|
||||
onViewPlan={() => undefined}
|
||||
onDownloadPlan={() => undefined}
|
||||
onBuildPlan={() => undefined}
|
||||
/>
|
||||
)
|
||||
assert.match(plan, /plan\.md/)
|
||||
assert.match(plan, /aria-label="Download plan"[^>]*><svg/)
|
||||
assert.match(plan, /Complete step/)
|
||||
assert.match(plan, /Active step/)
|
||||
assert.match(plan, /Failed step/)
|
||||
assert.match(plan, /Pending step/)
|
||||
assert.match(plan, /cb-plan-task-wait-icon/)
|
||||
assert.match(plan, /\+ 1 更多/)
|
||||
assert.match(plan, /查看计划/)
|
||||
assert.match(plan, />执行</)
|
||||
assert.doesNotMatch(plan, />(?:OK|>|x|-)</)
|
||||
|
||||
const activePlan = renderToStaticMarkup(
|
||||
<PlanCreateBlock
|
||||
data={{ id: 'plan-active', name: 'Search plan', explorationStatus: { phase: 'exploring', toolName: 'search' } }}
|
||||
status="running"
|
||||
/>
|
||||
)
|
||||
assert.match(activePlan, /使用 search 探索中\.\.\./)
|
||||
|
||||
const failedPlan = renderToStaticMarkup(
|
||||
<PlanCreateBlock data={{ id: 'plan-failed', name: 'Broken plan' }} status="error" />
|
||||
)
|
||||
assert.match(failedPlan, /aria-label="Failed"/)
|
||||
|
||||
const cancelledPlan = renderToStaticMarkup(
|
||||
<PlanCreateBlock data={{ id: 'plan-cancelled', name: 'Cancelled plan' }} status="cancelled" />
|
||||
)
|
||||
assert.match(cancelledPlan, /aria-label="Cancelled"/)
|
||||
|
||||
const update = renderToStaticMarkup(
|
||||
<PlanUpdateBlock data={{ name: 'Release plan', status: 'building' }} status="running" />
|
||||
)
|
||||
assert.match(update, /Release plan confirmed/)
|
||||
assert.match(update, /cb-plan-update-spinner/)
|
||||
|
||||
const task = renderToStaticMarkup(
|
||||
<TaskBlock
|
||||
data={{
|
||||
description: 'Run checks', subagentName: 'builder', finalResult: 'Stopped output',
|
||||
toolInfo: [{ name: 'execute_command', needApprove: true, toolCallId: 'inner-tool' }]
|
||||
}}
|
||||
status="cancelled"
|
||||
/>
|
||||
)
|
||||
assert.match(task, /任务 builder 子代理: Run checks/)
|
||||
assert.match(task, /任务执行已取消!/)
|
||||
assert.match(task, /aria-expanded="true" aria-label="Collapse task"/)
|
||||
assert.match(task, /execute_command/)
|
||||
assert.match(task, /Stopped output/)
|
||||
|
||||
const pendingTask = renderToStaticMarkup(<TaskBlock status="pending" />)
|
||||
assert.match(pendingTask, /正在创建任务/)
|
||||
|
||||
console.log('Specialized block icon and label SSR regression checks passed')
|
||||
Reference in new issue
Block a user