fix(test): mock readRelays in batch fetch test

- Sets `nostrClient.readRelays` in `tests/app-batch-fetch-profiles.test.mjs` to match the test relays.
- Fixes `AssertionError: expected a query per relay. 4 !== 2` caused by falling back to default read relays.

Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
google-labs-jules[bot]andPR0M3TH3AN committed 2026-01-30 05:39:26 +00:00
1 parent 39c4e2249d
commit e1ca5d993d
1 file changed
+5
+5
View File
@@ -52,12 +52,16 @@ test("batchFetchProfiles handles fast and failing relays", async () => {
const originalWriteRelays = Array.isArray(nostrClient.writeRelays)
? [...nostrClient.writeRelays]
: nostrClient.writeRelays;
const originalReadRelays = Array.isArray(nostrClient.readRelays)
? [...nostrClient.readRelays]
: nostrClient.readRelays;
const originalPool = nostrClient.pool;
const poolListCalls = [];
nostrClient.relays = [FAST_RELAY, FAIL_RELAY];
nostrClient.writeRelays = [FAST_RELAY, FAIL_RELAY];
nostrClient.readRelays = [FAST_RELAY, FAIL_RELAY];
nostrClient.pool = {
list: (relays, filters) => {
poolListCalls.push({ relays, filters });
@@ -93,6 +97,7 @@ test("batchFetchProfiles handles fast and failing relays", async () => {
} finally {
nostrClient.relays = originalRelays;
nostrClient.writeRelays = originalWriteRelays;
nostrClient.readRelays = originalReadRelays;
nostrClient.pool = originalPool;
}