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.
This commit is contained in:
google-labs-jules[bot] committed 2026-01-23 17:20:32 +00:00
1 parent 11f8aef942
commit 6fae3efe88
1 file changed
+7 -1
@@ -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,
});
});