aboutsummaryrefslogtreecommitdiffstats
path: root/frontend
diff options
context:
space:
mode:
Diffstat (limited to 'frontend')
-rw-r--r--frontend/src/components/FeedItem.test.tsx38
-rw-r--r--frontend/src/components/FeedItem.tsx10
2 files changed, 0 insertions, 48 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();
- });
});
diff --git a/frontend/src/components/FeedItem.tsx b/frontend/src/components/FeedItem.tsx
index ae6f8a5..03910e4 100644
--- a/frontend/src/components/FeedItem.tsx
+++ b/frontend/src/components/FeedItem.tsx
@@ -10,9 +10,6 @@ export default function FeedItem({ item: initialItem }: FeedItemProps) {
const [item, setItem] = useState(initialItem);
const [loading, setLoading] = useState(false);
- const toggleRead = () => {
- updateItem({ ...item, read: !item.read });
- };
const toggleStar = () => {
updateItem({ ...item, starred: !item.starred });
@@ -68,13 +65,6 @@ export default function FeedItem({ item: initialItem }: FeedItemProps) {
</a>
<div className="item-actions" style={{ display: 'inline-block', float: 'right' }}>
<button
- onClick={toggleRead}
- className={`action-btn ${item.read ? 'is-read' : 'is-unread'}`}
- title={item.read ? "Mark as unread" : "Mark as read"}
- >
- {item.read ? 'keep unread' : 'mark read'}
- </button>
- <button
onClick={toggleStar}
className={`action-btn ${item.starred ? 'is-starred' : 'is-unstarred'}`}
title={item.starred ? "Unstar" : "Star"}