From da79682ca36a161d10ebbdc334cc24a7112ad0f0 Mon Sep 17 00:00:00 2001 From: Saravana Achu Mac Date: Mon, 4 May 2026 16:34:45 -0700 Subject: [PATCH] fix(B6): persist code strategy saves Route CodeStrategyEditor saves through the canonical profile API instead of browser localStorage, carrying the active symbol plus ResearchView capital and risk defaults into an inactive saved code strategy profile. Refs: docs/AUDIT_REDESIGN.md item B6. Co-Authored-By: GPT-5 Codex --- .../strategy/CodeStrategyEditor.dom.test.tsx | 74 +++++++++++++++++++ .../strategy/CodeStrategyEditor.tsx | 55 +++++++++++--- web/src/views/ResearchView.tsx | 6 +- 3 files changed, 123 insertions(+), 12 deletions(-) create mode 100644 web/src/components/strategy/CodeStrategyEditor.dom.test.tsx diff --git a/web/src/components/strategy/CodeStrategyEditor.dom.test.tsx b/web/src/components/strategy/CodeStrategyEditor.dom.test.tsx new file mode 100644 index 0000000..8d692fa --- /dev/null +++ b/web/src/components/strategy/CodeStrategyEditor.dom.test.tsx @@ -0,0 +1,74 @@ +// @vitest-environment jsdom +import { describe, expect, it, vi, beforeEach, afterEach } from 'vitest'; +import { fireEvent, render, screen, waitFor } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; +import { CodeStrategyEditor } from './CodeStrategyEditor'; + +const { createTradeProfileMock } = vi.hoisted(() => ({ + createTradeProfileMock: vi.fn(), +})); + +vi.mock('@monaco-editor/react', () => ({ + default: ({ value, onChange }: any) => ( +