From d5a413382c93efeb1d888daf3216c51cd5f40f75 Mon Sep 17 00:00:00 2001 From: Adam Mathes Date: Sat, 14 Feb 2026 21:11:40 -0800 Subject: chore: fix lint and type errors to resolve CI failures --- frontend/src/components/FeedList.test.tsx | 58 ++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 20 deletions(-) (limited to 'frontend/src/components/FeedList.test.tsx') diff --git a/frontend/src/components/FeedList.test.tsx b/frontend/src/components/FeedList.test.tsx index 059d8a4..9ef2349 100644 --- a/frontend/src/components/FeedList.test.tsx +++ b/frontend/src/components/FeedList.test.tsx @@ -13,11 +13,15 @@ describe('FeedList Component', () => { }); it('renders loading state initially', () => { - (global.fetch as any).mockImplementation(() => new Promise(() => { })); + vi.mocked(global.fetch).mockImplementation(() => new Promise(() => { })); render( - {/* @ts-ignore */} - { }} /> + { }} + setSidebarVisible={() => { }} + isMobile={false} + /> ); expect(screen.getByText(/loading feeds/i)).toBeInTheDocument(); @@ -41,26 +45,31 @@ describe('FeedList Component', () => { }, ]; - (global.fetch as any).mockImplementation((url: string) => { - if (url.includes('/api/feed/')) { + vi.mocked(global.fetch).mockImplementation((url) => { + const urlStr = url.toString(); + if (urlStr.includes('/api/feed/')) { return Promise.resolve({ ok: true, json: async () => mockFeeds, - }); + } as Response); } - if (url.includes('/api/tag')) { + if (urlStr.includes('/api/tag')) { return Promise.resolve({ ok: true, json: async () => [{ title: 'Tech' }], - }); + } as Response); } return Promise.reject(new Error(`Unknown URL: ${url}`)); }); render( - {/* @ts-ignore */} - { }} /> + { }} + setSidebarVisible={() => { }} + isMobile={false} + /> ); @@ -80,12 +89,16 @@ describe('FeedList Component', () => { }); it('handles fetch error', async () => { - (global.fetch as any).mockImplementation(() => Promise.reject(new Error('API Error'))); + vi.mocked(global.fetch).mockImplementation(() => Promise.reject(new Error('API Error'))); render( - {/* @ts-ignore */} - { }} setSidebarVisible={() => { }} /> + { }} + setSidebarVisible={() => { }} + isMobile={false} + /> ); @@ -95,26 +108,31 @@ describe('FeedList Component', () => { }); it('handles empty feed list', async () => { - (global.fetch as any).mockImplementation((url: string) => { - if (url.includes('/api/feed/')) { + vi.mocked(global.fetch).mockImplementation((url) => { + const urlStr = url.toString(); + if (urlStr.includes('/api/feed/')) { return Promise.resolve({ ok: true, json: async () => [], - }); + } as Response); } - if (url.includes('/api/tag')) { + if (urlStr.includes('/api/tag')) { return Promise.resolve({ ok: true, json: async () => [], - }); + } as Response); } return Promise.reject(new Error(`Unknown URL: ${url}`)); }); render( - {/* @ts-ignore */} - { }} setSidebarVisible={() => { }} /> + { }} + setSidebarVisible={() => { }} + isMobile={false} + /> ); -- cgit v1.2.3