diff options
Diffstat (limited to 'frontend/src/components/TagView.test.tsx')
| -rw-r--r-- | frontend/src/components/TagView.test.tsx | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/frontend/src/components/TagView.test.tsx b/frontend/src/components/TagView.test.tsx index 8f7eb86..16fdee7 100644 --- a/frontend/src/components/TagView.test.tsx +++ b/frontend/src/components/TagView.test.tsx @@ -17,25 +17,31 @@ describe('Tag View Integration', () => { ]; const mockTags = [{ title: 'Tech' }, { title: 'News' }]; - (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 () => mockTags, - }); + } as Response); } return Promise.reject(new Error(`Unknown URL: ${url}`)); }); render( <MemoryRouter> - <FeedList theme="light" setTheme={() => { }} /> + <FeedList + theme="light" + setTheme={() => { }} + setSidebarVisible={() => { }} + isMobile={false} + /> </MemoryRouter> ); @@ -55,12 +61,13 @@ describe('Tag View Integration', () => { { _id: 101, title: 'Tag Item 1', url: 'http://example.com/1', feed_title: 'Feed 1' }, ]; - (global.fetch as any).mockImplementation((url: string) => { - if (url.includes('/api/stream')) { + vi.mocked(global.fetch).mockImplementation((url) => { + const urlStr = url.toString(); + if (urlStr.includes('/api/stream')) { return Promise.resolve({ ok: true, json: async () => mockItems, - }); + } as Response); } return Promise.reject(new Error(`Unknown URL: ${url}`)); }); |
