Merge pull request #1767 from PR0M3TH3AN/fix-hashtag-preferences-tests-17099357198215385317

Fix HashtagPreferencesService test failures due to missing signer
This commit is contained in:
thePR0M3TH3AN authored and GitHub committed 2026-01-26 20:43:59 -05:00
commit 8e6257881d
1 file changed
+27 -2
+27 -2
View File
@@ -34,11 +34,36 @@ function restoreNostrClient() {
: originalWriteRelays;
}
test.beforeEach(() => {
test.beforeEach(async () => {
hashtagPreferences.reset();
restoreNostrClient();
window.nostr = originalWindowNostr;
clearActiveSigner();
// Setup default mock signer to prevent auto-save errors
setActiveSigner({
signEvent: async (e) => ({ ...e, id: "fake" }),
nip44Encrypt: async () => "encrypted",
nip04Encrypt: async () => "encrypted",
});
// Setup default pool mock for publish and list
nostrClient.pool = {
list: async () => [],
publish: (urls, event) => ({
on: (eventName, handler) => {
if (eventName === "ok") {
setTimeout(() => handler(), 0);
}
return true;
},
}),
};
// Ensure writeRelays are set
nostrClient.writeRelays = ["wss://mock.relay"];
// Ensure active pubkey is set for publish operations
await hashtagPreferences.load("0".repeat(64));
});
test.after(() => {