refactor(data): 收口关系表运行时数据源
Some checks failed
Deploy Production / Build, push, deploy, verify (push) Has been cancelled
Some checks failed
Deploy Production / Build, push, deploy, verify (push) Has been cancelled
- 移除已迁移业务 AppData 运行时 fallback,改走领域 API 和关系表快读 - 补齐需求产品负责人、版本计划任务 JSON 和成员 username 回填迁移 - 统一治理字典入口,并补充 AI provider、数据源契约和领域服务测试 Co-Authored-By: Codex GPT-5 <codex@openai.com>
This commit is contained in:
@@ -3,11 +3,11 @@ import test from 'node:test';
|
||||
|
||||
import { selectWorkspaceCollections } from './workspace-v22-source';
|
||||
|
||||
const appData = {
|
||||
plans: [{ id: 'app-plan' }] as any[],
|
||||
devTasks: [{ id: 'app-dev' }] as any[],
|
||||
testCases: [{ id: 'app-test' }] as any[],
|
||||
bugs: [{ id: 'app-bug' }] as any[],
|
||||
const storeData = {
|
||||
plans: [{ id: 'store-plan' }] as any[],
|
||||
devTasks: [{ id: 'store-dev' }] as any[],
|
||||
testCases: [{ id: 'store-test' }] as any[],
|
||||
bugs: [{ id: 'store-bug' }] as any[],
|
||||
};
|
||||
|
||||
test('selectWorkspaceCollections prefers successfully loaded V2.2 data even when it is empty', () => {
|
||||
@@ -15,24 +15,63 @@ test('selectWorkspaceCollections prefers successfully loaded V2.2 data even when
|
||||
v22Loaded: true,
|
||||
v22Failed: false,
|
||||
v22Data: { versionPlans: [], devTasks: [], testCases: [], bugs: [] },
|
||||
appData,
|
||||
storeData,
|
||||
});
|
||||
|
||||
assert.deepEqual(selected, { versionPlans: [], devTasks: [], testCases: [], bugs: [] });
|
||||
});
|
||||
|
||||
test('selectWorkspaceCollections falls back to AppData only when V2.2 is unavailable', () => {
|
||||
test('selectWorkspaceCollections falls back to store data only when V2.2 is unavailable', () => {
|
||||
const selected = selectWorkspaceCollections({
|
||||
v22Loaded: false,
|
||||
v22Failed: true,
|
||||
v22Data: null,
|
||||
appData,
|
||||
storeData,
|
||||
});
|
||||
|
||||
assert.deepEqual(selected, {
|
||||
versionPlans: appData.plans,
|
||||
devTasks: appData.devTasks,
|
||||
testCases: appData.testCases,
|
||||
bugs: appData.bugs,
|
||||
versionPlans: storeData.plans,
|
||||
devTasks: storeData.devTasks,
|
||||
testCases: storeData.testCases,
|
||||
bugs: storeData.bugs,
|
||||
});
|
||||
});
|
||||
|
||||
test('selectWorkspaceCollections overlays local store changes onto V2.2 rows by id', () => {
|
||||
const selected = selectWorkspaceCollections({
|
||||
v22Loaded: true,
|
||||
v22Failed: false,
|
||||
v22Data: {
|
||||
versionPlans: [{ id: 'plan-1', status: 'pending' }] as any[],
|
||||
devTasks: [{ id: 'dev-1', status: 'todo' }] as any[],
|
||||
testCases: [{ id: 'tc-1', status: 'pending' }] as any[],
|
||||
bugs: [{ id: 'bug-1', status: 'open' }] as any[],
|
||||
},
|
||||
storeData: {
|
||||
plans: [
|
||||
{
|
||||
id: 'plan-1',
|
||||
status: 'in_progress',
|
||||
requirementCoverage: [
|
||||
{
|
||||
requirementId: 'req-1',
|
||||
status: 'not_started',
|
||||
currentWorkStartedAt: '2026-07-09T09:30:00.000Z',
|
||||
updatedAt: '2026-07-09T09:30:00.000Z',
|
||||
updatedBy: 'PM',
|
||||
},
|
||||
],
|
||||
},
|
||||
] as any[],
|
||||
devTasks: [{ id: 'dev-1', status: 'in_progress' }] as any[],
|
||||
testCases: [{ id: 'tc-1', status: 'running' }] as any[],
|
||||
bugs: [{ id: 'bug-1', status: 'fixing' }] as any[],
|
||||
},
|
||||
});
|
||||
|
||||
assert.equal(selected.versionPlans[0].status, 'in_progress');
|
||||
assert.equal(selected.versionPlans[0].requirementCoverage?.[0]?.currentWorkStartedAt, '2026-07-09T09:30:00.000Z');
|
||||
assert.equal(selected.devTasks[0].status, 'in_progress');
|
||||
assert.equal(selected.testCases[0].status, 'running');
|
||||
assert.equal(selected.bugs[0].status, 'fixing');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user