Why: the duties tab only listed existing documents — rdm.docs.instantiate had no UI entry, so a fresh project showed an empty duties tab with no setup path (owner trial feedback 2026-10-15). Evidence: new docs-instantiate-params tests green; full vitest run shows only the 12 pre-existing conversation-work failures also present at clean HEAD; design-guard green. Impact: duties tab gains a template picker + title input wired to rdm.docs.instantiate (backend command rdm.docs.templates lists published identities); instantiation refreshes the catalog and selects the new doc. Refs: Agent-System-RDM docs/records/dhf/u4-header-footer-slots.md
22 lines
899 B
TypeScript
22 lines
899 B
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { docsInstantiateParams } from '../src/components/adminRdmSections'
|
|
|
|
const tpl = {
|
|
templateId: 'dhf.2750fbaf1f67d10c', version: '1.0.0', title: '项目建议书',
|
|
docTypes: ['rd_proposal'], stage: '0. 商务阶段',
|
|
}
|
|
|
|
describe('docsInstantiateParams', () => {
|
|
it('carries docType/templateId/version and trims the title', () => {
|
|
expect(docsInstantiateParams(tpl, ' U5 试点项目建议书 ')).toEqual({
|
|
docType: 'rd_proposal', templateId: 'dhf.2750fbaf1f67d10c',
|
|
version: '1.0.0', title: 'U5 试点项目建议书',
|
|
})
|
|
})
|
|
it('omits blank titles so the backend falls back to the template title', () => {
|
|
const p = docsInstantiateParams(tpl, ' ')
|
|
expect(Object.hasOwn(p, 'title')).toBe(false)
|
|
expect(p).toEqual({ docType: 'rd_proposal', templateId: 'dhf.2750fbaf1f67d10c', version: '1.0.0' })
|
|
})
|
|
})
|