From 15e6bf85964110dd27bf09291c5971a62119e242 Mon Sep 17 00:00:00 2001
From: Adam Mathes <adam@adammathes.com>
Date: Fri, 13 Feb 2026 19:19:16 -0800
Subject: test: fix FeedList tests for collapsible state

---
 frontend/src/components/FeedList.test.tsx | 28 +++++++++++++++++++++++-----
 1 file changed, 23 insertions(+), 5 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 eba9b88..d5f49b7 100644
--- a/frontend/src/components/FeedList.test.tsx
+++ b/frontend/src/components/FeedList.test.tsx
@@ -1,6 +1,6 @@
 import React from 'react';
 import '@testing-library/jest-dom';
-import { render, screen, waitFor } from '@testing-library/react';
+import { render, screen, waitFor, fireEvent } from '@testing-library/react';
 import { describe, it, expect, vi, beforeEach } from 'vitest';
 import FeedList from './FeedList';
 
@@ -16,7 +16,8 @@ describe('FeedList Component', () => {
         (global.fetch as any).mockImplementation(() => new Promise(() => { }));
         render(
             <BrowserRouter>
-                <FeedList />
+                {/* @ts-ignore */}
+                <FeedList theme="light" setTheme={() => { }} />
             </BrowserRouter>
         );
         expect(screen.getByText(/loading feeds/i)).toBeInTheDocument();
@@ -46,10 +47,18 @@ describe('FeedList Component', () => {
 
         render(
             <BrowserRouter>
-                <FeedList />
+                {/* @ts-ignore */}
+                <FeedList theme="light" setTheme={() => { }} />
             </BrowserRouter>
         );
 
+        await waitFor(() => {
+            expect(screen.queryByText(/loading feeds/i)).not.toBeInTheDocument();
+        });
+
+        // Expand feeds
+        fireEvent.click(screen.getByText(/feeds/i, { selector: 'h2' }));
+
         await waitFor(() => {
             expect(screen.getByText('Feed One')).toBeInTheDocument();
             expect(screen.getByText('Feed Two')).toBeInTheDocument();
@@ -63,7 +72,8 @@ describe('FeedList Component', () => {
 
         render(
             <BrowserRouter>
-                <FeedList />
+                {/* @ts-ignore */}
+                <FeedList theme="light" setTheme={() => { }} />
             </BrowserRouter>
         );
 
@@ -91,10 +101,18 @@ describe('FeedList Component', () => {
 
         render(
             <BrowserRouter>
-                <FeedList />
+                {/* @ts-ignore */}
+                <FeedList theme="light" setTheme={() => { }} />
             </BrowserRouter>
         );
 
+        await waitFor(() => {
+            expect(screen.queryByText(/loading feeds/i)).not.toBeInTheDocument();
+        });
+
+        // Expand feeds
+        fireEvent.click(screen.getByText(/feeds/i, { selector: 'h2' }));
+
         await waitFor(() => {
             expect(screen.getByText(/no feeds found/i)).toBeInTheDocument();
         });
-- 
cgit v1.2.3

