From 781e293cf7b6ffb1883ea590c394edea5734748e Mon Sep 17 00:00:00 2001 From: Jannis Braun <151788261+TheZwiss@users.noreply.github.com> Date: Sat, 25 Apr 2026 19:29:06 +0200 Subject: [PATCH] chore(social-client): drop redundant comment, harden defineProperty Per code-review: - Drop the inline comment in sendFriendRequest; the commit message for the prior commit already covers the why and CLAUDE.md prefers no comments when the code is self-explanatory. - Add writable: true to the window.location defineProperty in the test so re-firing beforeEach across jsdom version drift is safe. --- packages/web/src/stores/socialStore.sendRequest.test.ts | 1 + packages/web/src/stores/socialStore.ts | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/web/src/stores/socialStore.sendRequest.test.ts b/packages/web/src/stores/socialStore.sendRequest.test.ts index 4dc3ef7f..367dddd1 100644 --- a/packages/web/src/stores/socialStore.sendRequest.test.ts +++ b/packages/web/src/stores/socialStore.sendRequest.test.ts @@ -51,6 +51,7 @@ describe('socialStore.sendFriendRequest — case-insensitive domain routing', () // Override it for routing tests. Object.defineProperty(window, 'location', { configurable: true, + writable: true, value: { ...window.location, host: 'local.test', hostname: 'local.test' }, }); }); diff --git a/packages/web/src/stores/socialStore.ts b/packages/web/src/stores/socialStore.ts index d2bef9b8..9a0878e6 100644 --- a/packages/web/src/stores/socialStore.ts +++ b/packages/web/src/stores/socialStore.ts @@ -218,7 +218,6 @@ export const useSocialStore = create((set, get) => ({ res = await api.social.sendRequest(username); } else { const baseName = username.slice(0, atIndex); - // Hostnames are case-insensitive; comparison RHS is canonical lowercase. const domain = username.slice(atIndex + 1).toLowerCase(); // Check if domain matches home instance