aboutsummaryrefslogtreecommitdiffstats
path: root/frontend-vanilla/src/main.test.ts
diff options
context:
space:
mode:
authorAdam Mathes <adam@adammathes.com>2026-02-16 08:34:05 -0800
committerAdam Mathes <adam@adammathes.com>2026-02-16 08:34:05 -0800
commitaee026b141532c11f8eb315ca77cc23f663901ae (patch)
treef1ceddb61a08a507245029e9485c35e961148544 /frontend-vanilla/src/main.test.ts
parentc74a18ded0777e176733ad07226f7ffd5cd64948 (diff)
downloadneko-aee026b141532c11f8eb315ca77cc23f663901ae.tar.gz
neko-aee026b141532c11f8eb315ca77cc23f663901ae.tar.bz2
neko-aee026b141532c11f8eb315ca77cc23f663901ae.zip
Implement feed management in settings
- Close NK-cuz8gh: v3 feed management - Add 'Manage Feeds' section to settings view in v3 UI - Implement deleteFeed and updateFeed helper functions - Add event listeners for deleting feeds and updating tags - Add tests for new functionality - Created NK-cdwj52 for bulk edit feature
Diffstat (limited to 'frontend-vanilla/src/main.test.ts')
-rw-r--r--frontend-vanilla/src/main.test.ts27
1 files changed, 27 insertions, 0 deletions
diff --git a/frontend-vanilla/src/main.test.ts b/frontend-vanilla/src/main.test.ts
index d397a5e..c9d0e0c 100644
--- a/frontend-vanilla/src/main.test.ts
+++ b/frontend-vanilla/src/main.test.ts
@@ -320,4 +320,31 @@ describe('main application logic', () => {
expect(navigateSpy).toHaveBeenCalledWith('/', expect.objectContaining({ filter: 'starred' }));
getCurrentRouteSpy.mockRestore();
});
+
+ it('deleteFeed should call API', async () => {
+ vi.mocked(apiFetch).mockResolvedValueOnce({ ok: true } as Response);
+ const { deleteFeed } = await import('./main');
+ await deleteFeed(123);
+ expect(apiFetch).toHaveBeenCalledWith('/api/feed/123', expect.objectContaining({ method: 'DELETE' }));
+ });
+
+ it('updateFeed should call API', async () => {
+ vi.mocked(apiFetch).mockResolvedValueOnce({ ok: true } as Response);
+ const { updateFeed } = await import('./main');
+ await updateFeed(123, { category: 'New Tag' });
+ expect(apiFetch).toHaveBeenCalledWith('/api/feed', expect.objectContaining({
+ method: 'PUT',
+ body: expect.stringContaining('"category":"New Tag"')
+ }));
+ });
+
+ it('renderSettings should show manage feeds section', () => {
+ store.setFeeds([{ _id: 1, title: 'My Feed', url: 'http://example.com', category: 'Tech' } as any]);
+ renderLayout();
+ renderSettings();
+ const manageSection = document.querySelector('.manage-feeds-section');
+ expect(manageSection).not.toBeNull();
+ expect(manageSection?.innerHTML).toContain('My Feed');
+ expect(document.querySelector('.feed-tag-input')).not.toBeNull();
+ });
});