From 6fae3efe885ea8af2747a79357202f6dacf2f0d8 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 23 Jan 2026 17:20:32 +0000 Subject: [PATCH] Fix nostr-client-unavailable error in ProfileModal moderation tests Added `ensurePool` mock to `nostrClient` in `tests/ui/profile-modal-moderation-settings.test.mjs` to prevent runtime errors when `ModerationService` is instantiated. Updated assertions to include `trustedMuteHideThresholds` as it is present in the default settings snapshot. --- tests/ui/profile-modal-moderation-settings.test.mjs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/ui/profile-modal-moderation-settings.test.mjs b/tests/ui/profile-modal-moderation-settings.test.mjs index 8d312b04..c4224e82 100644 --- a/tests/ui/profile-modal-moderation-settings.test.mjs +++ b/tests/ui/profile-modal-moderation-settings.test.mjs @@ -147,7 +147,9 @@ beforeEach(async () => { services: { relayManager: {}, userBlocks: {}, - nostrClient: {}, + nostrClient: { + ensurePool: async () => {}, + }, accessControl: {}, getCurrentUserNpub: () => null, moderationSettings: moderationService, @@ -226,6 +228,7 @@ test("moderation settings save updates service and disables control", async () = blurThreshold: 5, autoplayBlockThreshold: 4, trustedMuteHideThreshold: 2, + trustedMuteHideThresholds: {}, trustedSpamHideThreshold: 6, }); assert.equal(controller.moderationSaveButton.disabled, true); @@ -262,6 +265,7 @@ test("moderation reset restores defaults and clearing inputs uses defaults", asy blurThreshold: DEFAULT_BLUR_THRESHOLD, autoplayBlockThreshold: DEFAULT_AUTOPLAY_BLOCK_THRESHOLD, trustedMuteHideThreshold: DEFAULT_TRUSTED_MUTE_HIDE_THRESHOLD, + trustedMuteHideThresholds: {}, trustedSpamHideThreshold: DEFAULT_TRUSTED_SPAM_HIDE_THRESHOLD, }); assert.equal(controller.moderationBlurInput.value, DEFAULT_BLUR_STRING); @@ -288,6 +292,7 @@ test("moderation reset restores defaults and clearing inputs uses defaults", asy blurThreshold: 7, autoplayBlockThreshold: DEFAULT_AUTOPLAY_BLOCK_THRESHOLD, trustedMuteHideThreshold: DEFAULT_TRUSTED_MUTE_HIDE_THRESHOLD, + trustedMuteHideThresholds: {}, trustedSpamHideThreshold: 8, }); @@ -315,6 +320,7 @@ test("moderation reset restores defaults and clearing inputs uses defaults", asy blurThreshold: DEFAULT_BLUR_THRESHOLD, autoplayBlockThreshold: DEFAULT_AUTOPLAY_BLOCK_THRESHOLD, trustedMuteHideThreshold: DEFAULT_TRUSTED_MUTE_HIDE_THRESHOLD, + trustedMuteHideThresholds: {}, trustedSpamHideThreshold: DEFAULT_TRUSTED_SPAM_HIDE_THRESHOLD, }); });