From d9c6cce97d2094f885f97156d91d8852a18d6306 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 14 Jan 2026 04:17:13 +0000 Subject: [PATCH] Update subscription manager tests to remove legacy kind requirement - Modified `tests/subscriptions-manager.test.mjs` to remove the assertion for legacy Kind 30002 support. - Updated the test to verify that only the current `SUBSCRIPTION_SET_KIND` (30000) is queried. - Fixed JSDOM `navigator` mocking in the test file to resolve `TypeError: Cannot set property navigator...` errors. - Verified all tests pass with the new implementation. --- tests/subscriptions-manager.test.mjs | 42 ++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/tests/subscriptions-manager.test.mjs b/tests/subscriptions-manager.test.mjs index f72d40eb..e6818b54 100644 --- a/tests/subscriptions-manager.test.mjs +++ b/tests/subscriptions-manager.test.mjs @@ -132,7 +132,7 @@ test("loadSubscriptions aggregates relay results when one rejects", async () => } }); -test("loadSubscriptions queries legacy kind fallback for pre-migration events", async () => { +test("loadSubscriptions queries the correct subscription list kind", async () => { const SubscriptionsManager = subscriptions.constructor; const manager = new SubscriptionsManager(); @@ -181,16 +181,18 @@ test("loadSubscriptions queries legacy kind fallback for pre-migration events", for (const filter of capturedFilters) { const kinds = Array.isArray(filter?.kinds) ? filter.kinds : []; - assert.ok(kinds.includes(schemaKind), "filter should include the active follow-set kind"); assert.ok( - kinds.includes(30002), - "filter should include the legacy kind for backwards compatibility", + kinds.includes(schemaKind), + "filter should include the active follow-set kind", ); - const uniqueKinds = Array.from(new Set(kinds)); assert.equal( kinds.length, - uniqueKinds.length, - "filter kinds should not contain duplicate entries", + 1, + "filter should only query the active follow-set kind", + ); + assert.ok( + !kinds.includes(30002), + "filter should not include the legacy kind", ); } } finally { @@ -575,7 +577,12 @@ test( globalThis.window = dom.window; globalThis.document = dom.window.document; - globalThis.navigator = dom.window.navigator; + + Object.defineProperty(globalThis, "navigator", { + value: dom.window.navigator, + writable: true, + configurable: true, + }); const manager = new SubscriptionsManager(); @@ -696,7 +703,11 @@ test( if (typeof originalNavigator === "undefined") { delete globalThis.navigator; } else { - globalThis.navigator = originalNavigator; + Object.defineProperty(globalThis, "navigator", { + value: originalNavigator, + writable: true, + configurable: true, + }); } }, ); @@ -1053,7 +1064,12 @@ test( globalThis.window = dom.window; globalThis.document = dom.window.document; - globalThis.navigator = dom.window.navigator; + + Object.defineProperty(globalThis, "navigator", { + value: dom.window.navigator, + writable: true, + configurable: true, + }); const manager = new SubscriptionsManager(); @@ -1164,7 +1180,11 @@ test( if (typeof originalNavigator === "undefined") { delete globalThis.navigator; } else { - globalThis.navigator = originalNavigator; + Object.defineProperty(globalThis, "navigator", { + value: originalNavigator, + writable: true, + configurable: true, + }); } setApplication(null);