Refactor duplicate feed refresh logic into unified refreshFeed method

- Unify `refreshForYouFeed`, `refreshKidsFeed`, `refreshExploreFeed`, and `refreshRecentFeed` into `refreshFeed(feedType, options)`.
- Update `js/app/feedCoordinator.js` to implement `refreshFeed` and use it in `loadFeedVideos`.
- Update `js/app.js` to delegate specific methods to `refreshFeed`.
- Add `FEED_TYPES` import to `js/app.js`.
- Update `tests/app/feedCoordinator.test.mjs` to match the refactoring.

Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
google-labs-jules[bot]andPR0M3TH3AN committed 2026-02-08 00:35:47 +00:00
1 parent 566c2dbf89
commit b094d2a035
3 files changed
+99 -234

No files matched your search

+4 -6
View File
@@ -52,10 +52,7 @@ test('createFeedCoordinator - loadForYouVideos', async (t) => {
checkRelayHealthWarning: mock.fn(),
setFeedTelemetryContext: mock.fn(),
isAuthorBlocked: mock.fn(() => false),
refreshForYouFeed: mock.fn(async () => {}),
refreshRecentFeed: mock.fn(async () => {}),
refreshKidsFeed: mock.fn(async () => {}),
refreshExploreFeed: mock.fn(async () => {}),
refreshFeed: mock.fn(async () => {}),
blacklistedEventIds: new Set(),
};
@@ -80,8 +77,9 @@ test('createFeedCoordinator - loadForYouVideos', async (t) => {
// Verify nostrService.loadVideos called
assert.strictEqual(app.nostrService.loadVideos.mock.callCount(), 1, 'Should call nostrService.loadVideos');
// Verify refreshForYouFeed called via callback
assert.strictEqual(app.refreshForYouFeed.mock.callCount(), 1, 'Should call refreshForYouFeed via callback');
// Verify refreshFeed called via callback
assert.strictEqual(app.refreshFeed.mock.callCount(), 1, 'Should call refreshFeed via callback');
assert.strictEqual(app.refreshFeed.mock.calls[0].arguments[0], FEED_TYPES.FOR_YOU, 'Should call refreshFeed with FOR_YOU');
// Verify subscription updated
assert.strictEqual(app.videoSubscription, 'mock-subscription', 'Should update videoSubscription');