fix: preserve turnover deep-link snapshots and clarify data status

This commit is contained in:
2026-10-14 01:52:20 +08:00
parent 2cf9129606
commit 02a9d72ef8
6 changed files with 35 additions and 8 deletions
@@ -1,7 +1,12 @@
import { describe, expect, it } from 'vitest'
import { turnoverChart, turnoverNumber, windowText } from './turnoverPresentation'
import { turnoverChart, turnoverNumber, windowText, turnoverReasonsText } from './turnoverPresentation'
import type { TurnoverCharts, TurnoverWindowMetric } from './turnoverTypes'
describe('turnover honest precision and charts', () => {
it('explains missing samples and zero average stock without exposing internal statuses', () => {
expect(turnoverReasonsText(['INSUFFICIENT'])).toBe('合格日库存样本不足')
expect(turnoverReasonsText(['ZERO_AVERAGE_STOCK'])).toContain('每日观测未捕获存量')
expect(turnoverReasonsText(['INVENTORY_UNKNOWN_OR_STALE'])).toContain('已过期')
})
it('keeps tiny positive values distinct from zero and unknown', () => {
expect(turnoverNumber(0.000001)).toBe('<0.01')
expect(turnoverNumber(0.01, 1)).toBe('<0.1')