feat(research): disclose saved result provenance and limitations

This commit is contained in:
Boki 2026-10-22 14:50:24 -04:00
parent 43ffb547be
commit fe00ecd0e2
12 changed files with 456 additions and 12 deletions

View file

@ -72,7 +72,7 @@ test('compact metrics preserve null ratios and render a genuine zero profit', ()
dataFrequency: '1d',
parameters: {},
},
metrics,
metrics: { ...metrics, totalProfit: 0 },
equity: [],
ohlcData: {},
positions: [],
@ -88,3 +88,34 @@ test('compact metrics preserve null ratios and render a genuine zero profit', ()
expect(rendered).toContain('$0.00');
expect(rendered).not.toMatch(/Infinity|NaN/);
});
test('null_metrics: detailed exposure is unavailable rather than a measured zero', () => {
const rendered = text(
renderToStaticMarkup(
createElement(BacktestMetrics, {
isLoading: false,
result: {
id: 'fixture',
config: {
name: 'fixture',
startDate: new Date('2024-01-01'),
endDate: new Date('2024-02-01'),
initialCapital: 1000,
symbols: ['A.US'],
strategy: 'sma',
speedMultiplier: 0,
commission: 0,
slippage: 0,
},
metrics,
positions: [],
trades: [],
performanceData: [],
analytics: { exposureTime: null },
},
})
)
);
expect(rendered).toContain('Exposure TimeN/A');
expect(rendered).not.toContain('Exposure Time0.0%');
});