diff options
Diffstat (limited to 'frontend/src/lib/resultsAccounting.test.ts')
| -rw-r--r-- | frontend/src/lib/resultsAccounting.test.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/frontend/src/lib/resultsAccounting.test.ts b/frontend/src/lib/resultsAccounting.test.ts index 5dc5bd6..deedaa9 100644 --- a/frontend/src/lib/resultsAccounting.test.ts +++ b/frontend/src/lib/resultsAccounting.test.ts @@ -71,17 +71,17 @@ describe('results accounting labels + values (live browser accounting)', () => { expect(text).not.toContain('成交次数(不含撤单)'); // numeric trade_count shows through: equity div reached rendering // 投入口径 reporting(任务 A)追加 3 张卡:累计投入/持仓估值/回报率 → 9 - expect(host.querySelectorAll('[data-slot="card"].m-tile, .m-tile').length).toBe(9); + expect(host.querySelectorAll('[data-slot="card"].gap-1').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 rows = [...host.querySelectorAll('[data-testid="capital-reporting"]').length ? host.querySelectorAll('td') : []].length >= 0 ? [...host.querySelectorAll('td')].map((td) => td.textContent.trim()) : []; const hasSell = [...host.children].join('').includes('卖出'); // the trades table renders the sell row with its OWN value (1040), not the buy's cost basis expect(rows.filter((v) => v === '1020.00' || v === '1040.00').length).toBe(2); // trade_count metric value renders - expect([...host.querySelectorAll('.mvalue')].some((n) => n.textContent === '1')).toBe(true); + expect([...host.querySelectorAll('[data-testid="metric-value"]')].some((n) => n.textContent === '1')).toBe(true); } finally { unmount(inst); host.remove(); vi.unstubAllGlobals(); } }); it('comparison labels use the same closed-round-trip semantics', () => { |
