aboutsummaryrefslogtreecommitdiffstats
path: root/frontend/src/components/FeedItems.test.tsx
diff options
context:
space:
mode:
authorAdam Mathes <adam@adammathes.com>2026-02-14 21:11:40 -0800
committerAdam Mathes <adam@adammathes.com>2026-02-14 21:11:40 -0800
commitd5a413382c93efeb1d888daf3216c51cd5f40f75 (patch)
treea7d8505a0a1c90050ea6bd33c02f7e8a5b5537e5 /frontend/src/components/FeedItems.test.tsx
parenta7369274ba24298a0449865f147fc65253e992a2 (diff)
downloadneko-d5a413382c93efeb1d888daf3216c51cd5f40f75.tar.gz
neko-d5a413382c93efeb1d888daf3216c51cd5f40f75.tar.bz2
neko-d5a413382c93efeb1d888daf3216c51cd5f40f75.zip
chore: fix lint and type errors to resolve CI failures
Diffstat (limited to 'frontend/src/components/FeedItems.test.tsx')
-rw-r--r--frontend/src/components/FeedItems.test.tsx31
1 files changed, 18 insertions, 13 deletions
diff --git a/frontend/src/components/FeedItems.test.tsx b/frontend/src/components/FeedItems.test.tsx
index cf1e708..25ade58 100644
--- a/frontend/src/components/FeedItems.test.tsx
+++ b/frontend/src/components/FeedItems.test.tsx
@@ -17,11 +17,12 @@ describe('FeedItems Component', () => {
unobserve = vi.fn();
disconnect = vi.fn();
}
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
window.IntersectionObserver = MockIntersectionObserver as any;
});
it('renders loading state', () => {
- (global.fetch as any).mockImplementation(() => new Promise(() => { }));
+ vi.mocked(global.fetch).mockImplementation(() => new Promise(() => { }));
render(
<MemoryRouter initialEntries={['/feed/1']}>
<Routes>
@@ -50,10 +51,10 @@ describe('FeedItems Component', () => {
},
];
- (global.fetch as any).mockResolvedValueOnce({
+ vi.mocked(global.fetch).mockResolvedValueOnce({
ok: true,
json: async () => mockItems,
- });
+ } as Response);
render(
<MemoryRouter initialEntries={['/feed/1']}>
@@ -79,10 +80,10 @@ describe('FeedItems Component', () => {
{ _id: 102, title: 'Item 2', url: 'u2', read: true, starred: false },
];
- (global.fetch as any).mockResolvedValue({
+ vi.mocked(global.fetch).mockResolvedValue({
ok: true,
json: async () => mockItems,
- });
+ } as Response);
render(
<MemoryRouter>
@@ -134,10 +135,10 @@ describe('FeedItems Component', () => {
it('marks items as read when scrolled past', async () => {
const mockItems = [{ _id: 101, title: 'Item 1', url: 'u1', read: false, starred: false }];
- (global.fetch as any).mockResolvedValue({
+ vi.mocked(global.fetch).mockResolvedValue({
ok: true,
json: async () => mockItems,
- });
+ } as Response);
// Capture both callbacks
const observerCallbacks: IntersectionObserverCallback[] = [];
@@ -151,8 +152,10 @@ describe('FeedItems Component', () => {
unobserve = vi.fn();
disconnect = vi.fn();
}
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
window.IntersectionObserver = MockIntersectionObserver as any;
+
render(
<MemoryRouter>
<FeedItems />
@@ -201,9 +204,9 @@ describe('FeedItems Component', () => {
const initialItems = [{ _id: 101, title: 'Item 1', url: 'u1', read: true, starred: false }];
const moreItems = [{ _id: 100, title: 'Item 0', url: 'u0', read: true, starred: false }];
- (global.fetch as any)
- .mockResolvedValueOnce({ ok: true, json: async () => initialItems })
- .mockResolvedValueOnce({ ok: true, json: async () => moreItems });
+ vi.mocked(global.fetch)
+ .mockResolvedValueOnce({ ok: true, json: async () => initialItems } as Response)
+ .mockResolvedValueOnce({ ok: true, json: async () => moreItems } as Response);
const observerCallbacks: IntersectionObserverCallback[] = [];
class MockIntersectionObserver {
@@ -214,8 +217,10 @@ describe('FeedItems Component', () => {
unobserve = vi.fn();
disconnect = vi.fn();
}
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
window.IntersectionObserver = MockIntersectionObserver as any;
+
render(
<MemoryRouter>
<FeedItems />
@@ -267,9 +272,9 @@ describe('FeedItems Component', () => {
{ _id: 100, title: 'Item 0', url: 'u0', read: true, starred: false },
];
- (global.fetch as any)
- .mockResolvedValueOnce({ ok: true, json: async () => initialItems })
- .mockResolvedValueOnce({ ok: true, json: async () => moreItems });
+ vi.mocked(global.fetch)
+ .mockResolvedValueOnce({ ok: true, json: async () => initialItems } as Response)
+ .mockResolvedValueOnce({ ok: true, json: async () => moreItems } as Response);
render(
<MemoryRouter>