From 79ad3c4709934e2bbd053bf6fe59dac4a93f98dc Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 30 Jan 2026 13:46:17 +0000 Subject: [PATCH] fix(test): resolve unit test failures in batch fetch and profile modal - Mock `readRelays` in `tests/app-batch-fetch-profiles.test.mjs` to correctly reflect `profileMetadataService` prioritization logic, ensuring relay query count assertions match actual execution (2 queries instead of 4). - Add missing `load` mock to `hashtagPreferences` in `tests/profile-modal-controller.test.mjs` to prevent `TypeError` during `handleAddHashtagPreference` test. - Verified all unit tests pass with `npm run test:unit`. - Verified `npm run build` succeeds locally. - Verified `_headers` and `_redirects` are present and valid in `dist/`. This commit addresses the CI failures reported by the user, including the `agent-review` failure and likely resolving the associated 'Deploy failed' checks. Co-authored-by: PR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> --- tests/app-batch-fetch-profiles.test.mjs | 5 +++++ tests/profile-modal-controller.test.mjs | 1 + 2 files changed, 6 insertions(+) diff --git a/tests/app-batch-fetch-profiles.test.mjs b/tests/app-batch-fetch-profiles.test.mjs index df90a4bc..45148645 100644 --- a/tests/app-batch-fetch-profiles.test.mjs +++ b/tests/app-batch-fetch-profiles.test.mjs @@ -49,6 +49,9 @@ test("batchFetchProfiles handles fast and failing relays", async () => { const originalRelays = Array.isArray(nostrClient.relays) ? [...nostrClient.relays] : []; + const originalReadRelays = Array.isArray(nostrClient.readRelays) + ? [...nostrClient.readRelays] + : nostrClient.readRelays; const originalWriteRelays = Array.isArray(nostrClient.writeRelays) ? [...nostrClient.writeRelays] : nostrClient.writeRelays; @@ -57,6 +60,7 @@ test("batchFetchProfiles handles fast and failing relays", async () => { const poolListCalls = []; nostrClient.relays = [FAST_RELAY, FAIL_RELAY]; + nostrClient.readRelays = [FAST_RELAY, FAIL_RELAY]; nostrClient.writeRelays = [FAST_RELAY, FAIL_RELAY]; nostrClient.pool = { list: (relays, filters) => { @@ -92,6 +96,7 @@ test("batchFetchProfiles handles fast and failing relays", async () => { }); } finally { nostrClient.relays = originalRelays; + nostrClient.readRelays = originalReadRelays; nostrClient.writeRelays = originalWriteRelays; nostrClient.pool = originalPool; } diff --git a/tests/profile-modal-controller.test.mjs b/tests/profile-modal-controller.test.mjs index f14c3730..9d746088 100644 --- a/tests/profile-modal-controller.test.mjs +++ b/tests/profile-modal-controller.test.mjs @@ -275,6 +275,7 @@ function createController(options = {}) { }, publish: async () => ({ ok: true }), on: () => () => {}, + load: async () => {}, }; const hashtagPreferences = {