import assert from 'node:assert/strict' import { renderToStaticMarkup } from 'react-dom/server' import SourcePermissionControl from '../src/renderer/src/workbuddy/composer/permission/SourcePermissionControl' for (const mode of ['default-sandbox', 'full-access'] as const) { const render = (nextSend: boolean, disabled = false) => renderToStaticMarkup( { throw new Error('render must not mutate policy') }} onError={() => {}} />) const busy = render(true) assert.ok(busy.includes('下次发送生效'), 'busy selector must identify future policy, not claim current policy changed') assert.ok(!busy.includes('disabled=""'), 'a running/sending turn must not disable preference selection') assert.ok(!render(false).includes('下次发送生效')) assert.ok(render(true, true).includes('disabled=""'), 'plan/ask and load guards remain enforceable') } console.log('Next-send permission labels and enabled/disabled static rendering passed')