Mock lightweight-charts in StockDetail UI test to avoid canvas requirement

This commit is contained in:
2026-05-16 14:01:01 +02:00
parent ea2836bd2e
commit ac175c8d42
@@ -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";