From 3ba71500bc2d60a00ca81b9439305029670f4d52 Mon Sep 17 00:00:00 2001
From: Adam Mathes <adam@adammathes.com>
Date: Fri, 13 Feb 2026 06:55:21 -0800
Subject: Implement Frontend Feed Items View with tests

---
 frontend/src/components/FeedList.test.tsx | 26 ++++++++++++++++++++++----
 1 file changed, 22 insertions(+), 4 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 578e3c2..92ff345 100644
--- a/frontend/src/components/FeedList.test.tsx
+++ b/frontend/src/components/FeedList.test.tsx
@@ -4,6 +4,8 @@ import { render, screen, waitFor } from '@testing-library/react';
 import { describe, it, expect, vi, beforeEach } from 'vitest';
 import FeedList from './FeedList';
 
+import { BrowserRouter } from 'react-router-dom';
+
 describe('FeedList Component', () => {
     beforeEach(() => {
         vi.resetAllMocks();
@@ -12,7 +14,11 @@ describe('FeedList Component', () => {
 
     it('renders loading state initially', () => {
         (global.fetch as any).mockImplementation(() => new Promise(() => { }));
-        render(<FeedList />);
+        render(
+            <BrowserRouter>
+                <FeedList />
+            </BrowserRouter>
+        );
         expect(screen.getByText(/loading feeds/i)).toBeInTheDocument();
     });
 
@@ -27,7 +33,11 @@ describe('FeedList Component', () => {
             json: async () => mockFeeds,
         });
 
-        render(<FeedList />);
+        render(
+            <BrowserRouter>
+                <FeedList />
+            </BrowserRouter>
+        );
 
         await waitFor(() => {
             expect(screen.getByText('Feed One')).toBeInTheDocument();
@@ -39,7 +49,11 @@ describe('FeedList Component', () => {
     it('handles fetch error', async () => {
         (global.fetch as any).mockRejectedValueOnce(new Error('API Error'));
 
-        render(<FeedList />);
+        render(
+            <BrowserRouter>
+                <FeedList />
+            </BrowserRouter>
+        );
 
         await waitFor(() => {
             expect(screen.getByText(/error: api error/i)).toBeInTheDocument();
@@ -52,7 +66,11 @@ describe('FeedList Component', () => {
             json: async () => [],
         });
 
-        render(<FeedList />);
+        render(
+            <BrowserRouter>
+                <FeedList />
+            </BrowserRouter>
+        );
 
         await waitFor(() => {
             expect(screen.getByText(/no feeds found/i)).toBeInTheDocument();
-- 
cgit v1.2.3

