From ac175c8d42e40d2bbe2d3745894717a2f77099e6 Mon Sep 17 00:00:00 2001 From: Henry Winkel Date: Sat, 16 May 2026 14:01:01 +0200 Subject: [PATCH] Mock lightweight-charts in StockDetail UI test to avoid canvas requirement --- app/routes/__tests__/analyze.ticker.ui.test.tsx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/routes/__tests__/analyze.ticker.ui.test.tsx b/app/routes/__tests__/analyze.ticker.ui.test.tsx index 07c07b3..064b2ed 100644 --- a/app/routes/__tests__/analyze.ticker.ui.test.tsx +++ b/app/routes/__tests__/analyze.ticker.ui.test.tsx @@ -1,5 +1,16 @@ import { describe, it, expect, vi, beforeEach } from "vitest"; import { render, screen, fireEvent, waitFor } from "@testing-library/react"; + +// Mock lightweight-charts to avoid canvas in test environment +vi.mock("lightweight-charts", () => ({ + createChart: () => ({ + timeScale: () => ({ applyOptions: () => {}, fitContent: () => {} }), + addSeries: () => ({ setData: () => {} }), + remove: () => {}, + }), + CandlestickSeries: {}, +})); + import StockDetail from "../analyze.ticker"; import { MemoryRouter } from "react-router";