Remove legacy auth cache migration docs and add regression test

Removes obsolete "Migration notes" from `docs/nostr-auth.md` and
adds a regression test to `tests/state/cache-saved-profiles.test.mjs`
to confirm that the legacy `userPubKey` localStorage key is ignored
during startup. Also polyfills localStorage for the test suite.
This commit is contained in:
google-labs-jules[bot] committed 2026-01-07 00:20:01 +00:00
1 parent ad961cd401
commit f5eba4121f
2 files changed
+14 -12

No files matched your search

+12
View File
@@ -1,3 +1,4 @@
import "../test-helpers/setup-localstorage.mjs";
import test from "node:test";
import assert from "node:assert/strict";
@@ -149,3 +150,14 @@ test("loadSavedProfilesFromStorage trims stored authType values", () => {
assert.equal(stored.entries[0].authType, "extension-provider");
assert.equal(stored.entries[0].providerId, "extension-provider");
});
test("loadSavedProfilesFromStorage ignores legacy userPubKey", () => {
resetSavedProfilesState();
localStorage.setItem("userPubKey", SAMPLE_PUBKEY);
// Ensure the modern key is missing/empty
localStorage.removeItem(STORAGE_KEY);
const { profiles } = loadSavedProfilesFromStorage();
assert.equal(profiles.length, 0, "Expected no profiles to be loaded from legacy key");
});