import test from 'node:test'; import assert from 'node:assert/strict'; import { Project, ProjectWorkflow, WorkflowDefinition, DocumentLineage, } from '../types/projectWorkflow'; test('Project workflow types validation', () => { const p: Project = { id: 1001, code: 'electro-cutter-01', name: '智能高频电刀', status: 'active', creator_user_id: 2, active_workflow_key: 'main', workflow_selection_version: 1, created_at: new Date().toISOString(), updated_at: new Date().toISOString(), }; assert.equal(p.id, 1001); assert.equal(p.creator_user_id, 2); assert.equal(p.active_workflow_key, 'main'); const pw: ProjectWorkflow = { id: 1, project_id: 1001, workflow_key: 'product_manager', is_active: true, display_order: 2, created_at: new Date().toISOString(), updated_at: new Date().toISOString(), }; assert.equal(pw.workflow_key, 'product_manager'); const lineage: DocumentLineage = { id: 1, project_id: 1001, downstream_doc_id: 'doc_proj1001_test_manager', downstream_version: 1, upstream_doc_id: 'doc_proj1001_system_reqs', upstream_version: 1, upstream_sha256: 'sha_upstream', is_stale: false, created_at: new Date().toISOString(), }; assert.equal(lineage.is_stale, false); assert.equal(lineage.upstream_doc_id, 'doc_proj1001_system_reqs'); const def: WorkflowDefinition = { key: 'product_manager', name: '智能产品经理工作流', description: '深入分析用户需求并输出系统需求规格书', category: 'system_engineering', enabled: true, task_key: 'system_reqs', prerequisites: [], outputs: ['system_reqs'], }; assert.equal(def.key, 'product_manager'); });