import { expect, test } from 'bun:test'; import { experimentInputSchema, experimentSubmissionSchema, } from '@stock-bot/stock-config/experiments'; test('reserved raw grid keys cannot silently become a baseline experiment', () => { for (const key of ['__proto__', 'constructor', 'prototype']) { const input = JSON.parse( `{"backtestId":"00000000-0000-4000-8000-000000000001","name":"Sweep","grid":{"${key}":[1]}}` ); expect(experimentInputSchema.safeParse(input).success).toBe(false); expect( experimentSubmissionSchema.safeParse({ ...input, previewHash: 'a'.repeat(64) }).success ).toBe(false); } expect( experimentInputSchema.parse({ backtestId: '00000000-0000-4000-8000-000000000001', name: 'Baseline', grid: {}, }).grid ).toEqual({}); });