fix(web): preserve historical backtests with null configuration (CL25)
This commit is contained in:
parent
731acc41db
commit
ed7429cfbc
10 changed files with 41 additions and 23 deletions
|
|
@ -90,6 +90,14 @@ function respond(body: unknown, status = 200) {
|
|||
return fetch;
|
||||
}
|
||||
|
||||
test('historical templates with SQL-null configuration remain readable without rewriting them', async () => {
|
||||
const mapped = mapBacktest({ ...row, config: null });
|
||||
const wire = JSON.parse(JSON.stringify(mapped));
|
||||
expect(backtestResponseSchema.parse(wire).config).toBeNull();
|
||||
respond(mapped);
|
||||
expect((await backtest.backtestApiV2.getBacktest(backtestId)).config).toBeNull();
|
||||
});
|
||||
|
||||
test('real server backtest/run mappings survive JSON serialization and display the server clock field', async () => {
|
||||
const mapped = mapBacktest(row);
|
||||
respond(mapped);
|
||||
|
|
@ -133,7 +141,7 @@ test('existing optional fields remain optional without accepting malformed rende
|
|||
for (const bad of [
|
||||
{ ...serialized, symbols: 'AAPL' },
|
||||
{ ...serialized, initialCapital: '10000' },
|
||||
{ ...serialized, config: null },
|
||||
{ ...serialized, config: [] },
|
||||
]) {
|
||||
respond(bad);
|
||||
await expect(backtest.backtestApiV2.getBacktest(backtestId)).rejects.toThrow(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue