summaryrefslogtreecommitdiff
path: root/frontend/src/lib/resultsAccounting.test.ts
diff options
context:
space:
mode:
authorSomhairle H. Marisol <[email protected]>2026-09-18 10:36:17 +0800
committerSomhairle H. Marisol <[email protected]>2026-09-18 10:36:17 +0800
commitcad7b02266c6fc582f4ea70422f0128fd0178f02 (patch)
treef6c7bcfe601b9e004d60cbd3ec7ba3b47771fd0e /frontend/src/lib/resultsAccounting.test.ts
parentf3831e6cc62938c94b398e93e9f25e6f22164266 (diff)
downloadstrategy-lab-cad7b02266c6fc582f4ea70422f0128fd0178f02.tar.gz
feat(frontend): 回测结果页与对比表接入投入口径一行三项
[变更性质] 页面集成,任务 A1/A2 前端口径统一。 [新增功能] 结果页 metric 区新增累计投入/最终持仓估值/投入回报率三卡(data-testid=capital-reporting,注明"不含初始账户闲置现金"口径),复用现有 .metric 与 formatMoney 数字格式、不加新字色;实验记录页条件差异表新增同口径三行(逐 run 对照,动作同步深化到 status/time 之后)。 [实现方案] 共享 capitalReporting 推导;resultsAccounting.test 断言更新为 9 张 metric 卡并新增三卡 DOM 实测断言。 [影响范围] ProjectResultsTab、RunsPage、resultsAccounting.test;vitest 84/84。
Diffstat (limited to 'frontend/src/lib/resultsAccounting.test.ts')
-rw-r--r--frontend/src/lib/resultsAccounting.test.ts6
1 files changed, 5 insertions, 1 deletions
diff --git a/frontend/src/lib/resultsAccounting.test.ts b/frontend/src/lib/resultsAccounting.test.ts
index cccb7ed..b695713 100644
--- a/frontend/src/lib/resultsAccounting.test.ts
+++ b/frontend/src/lib/resultsAccounting.test.ts
@@ -70,7 +70,11 @@ describe('results accounting labels + values (live browser accounting)', () => {
expect(text).toContain('已完成的开仓并全部平仓的完整回合');
expect(text).not.toContain('成交次数(不含撤单)');
// numeric trade_count shows through: equity div reached rendering
- expect(host.querySelectorAll('.metric').length).toBe(6);
+ // 投入口径 reporting(任务 A)追加 3 张卡:累计投入/持仓估值/回报率 → 9
+ expect(host.querySelectorAll('.metric').length).toBe(9);
+ expect(host.querySelectorAll('[data-testid="capital-reporting"]').length).toBe(1);
+ expect(text).toContain('累计投入');
+ expect(text).toContain('投入口径不含初始账户闲置现金');
// turnover: two fills with distinct values (buy vs sell prices differ)
const rows = [...host.querySelectorAll('td.num')].map((td) => td.textContent.trim());
const hasSell = [...host.children].join('').includes('卖出');