diff --git a/web/src/views/HomeView.dom.test.tsx b/web/src/views/HomeView.dom.test.tsx index d72e12f..1e94573 100644 --- a/web/src/views/HomeView.dom.test.tsx +++ b/web/src/views/HomeView.dom.test.tsx @@ -85,7 +85,7 @@ describe('TickerHeader', () => { }); it('opens watchlist and alerts routes from header actions', async () => { - fetchResearchProfileMock.mockResolvedValue({ companyName: 'Apple Inc.' }); + fetchResearchProfileMock.mockResolvedValue({ companyName: 'Apple Inc.', exchangeShortName: 'NYSE' }); const user = userEvent.setup(); const firstRender = renderTickerHeader(); @@ -112,7 +112,7 @@ describe('TickerHeader', () => { }); it('shows the latest chart bar timestamp instead of the render time', async () => { - fetchResearchProfileMock.mockResolvedValue({ companyName: 'Apple Inc.' }); + fetchResearchProfileMock.mockResolvedValue({ companyName: 'Apple Inc.', exchangeShortName: 'NYSE' }); fetchChartBarsMock.mockResolvedValueOnce([ { ts: Date.UTC(2024, 0, 3, 19, 30), open: 210, high: 213, low: 209, close: 212, volume: 1000 }, { ts: Date.UTC(2024, 0, 3, 20, 30), open: 212, high: 214, low: 211, close: 213, volume: 1200 }, @@ -122,10 +122,18 @@ describe('TickerHeader', () => { expect(screen.getByText(/Latest bar pending ET/)).toBeInTheDocument(); await waitFor(() => { - expect(screen.getByText(/Jan 3, 2024, 03:30 PM ET · NASDAQ/)).toBeInTheDocument(); + expect(screen.getByText(/Jan 3, 2024, 03:30 PM ET · NYSE/)).toBeInTheDocument(); }); }); + it('falls back to a neutral exchange marker when profile exchange is unavailable', async () => { + fetchResearchProfileMock.mockResolvedValue({ companyName: 'Apple Inc.' }); + + renderTickerHeader(); + + await waitFor(() => expect(screen.getByText(/Latest bar pending ET · —/)).toBeInTheDocument()); + }); + it('derives quick stats from chart bars for symbols missing bot indicators', async () => { fetchResearchProfileMock.mockResolvedValue({ companyName: 'Microsoft Corporation' }); fetchChartBarsMock.mockResolvedValueOnce( diff --git a/web/src/views/HomeView.tsx b/web/src/views/HomeView.tsx index 081bafc..da2f72b 100644 --- a/web/src/views/HomeView.tsx +++ b/web/src/views/HomeView.tsx @@ -188,6 +188,9 @@ export function TickerHeader({ const positive = change >= 0; const company = profile?.companyName; const companyName = typeof company === 'string' && company.trim() ? company.trim() : symbol; + const exchange = typeof profile?.exchangeShortName === 'string' && profile.exchangeShortName.trim() + ? profile.exchangeShortName.trim() + : '—'; return (
@@ -239,7 +242,7 @@ export function TickerHeader({
- {formatAsOfTimestamp(latestBarTimestamp ?? null)} ET · NASDAQ + {formatAsOfTimestamp(latestBarTimestamp ?? null)} ET · {exchange}
);