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 not add a timing hint') assert.equal(busy, render(false), 'busy and idle permission selectors must have identical labels and markup') 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('Permission labels stay concise across busy/idle states; enabled/disabled static rendering passed')