diff options
Diffstat (limited to 'frontend/src/components/FeedItem.test.tsx')
| -rw-r--r-- | frontend/src/components/FeedItem.test.tsx | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/frontend/src/components/FeedItem.test.tsx b/frontend/src/components/FeedItem.test.tsx index d46afaf..5e7522f 100644 --- a/frontend/src/components/FeedItem.test.tsx +++ b/frontend/src/components/FeedItem.test.tsx @@ -30,27 +30,6 @@ describe('FeedItem Component', () => { // Check for relative time or date formatting? For now just check it renders }); - it('toggles read status', async () => { - (global.fetch as any).mockResolvedValueOnce({ ok: true, json: async () => ({}) }); - - render(<FeedItem item={mockItem} />); - - const readBtn = screen.getByTitle('Mark as read'); - fireEvent.click(readBtn); - - // Optimistic update - expect(await screen.findByTitle('Mark as unread')).toBeInTheDocument(); - - expect(global.fetch).toHaveBeenCalledWith('/api/item/1', expect.objectContaining({ - method: 'PUT', - body: JSON.stringify({ - _id: 1, - read: true, - starred: false - }) - })); - }); - it('toggles star status', async () => { (global.fetch as any).mockResolvedValueOnce({ ok: true, json: async () => ({}) }); @@ -71,21 +50,4 @@ describe('FeedItem Component', () => { }) })); }); - - it('reverts optimistic update on failure', async () => { - (global.fetch as any).mockRejectedValueOnce(new Error('API Error')); - const consoleSpy = vi.spyOn(console, 'error').mockImplementation(() => { }); - - render(<FeedItem item={mockItem} />); - - const readBtn = screen.getByTitle('Mark as read'); - fireEvent.click(readBtn); - - // Should revert to unread - await waitFor(() => { - expect(screen.getByTitle('Mark as read')).toBeInTheDocument(); - }); - - consoleSpy.mockRestore(); - }); }); |
