Repository navigation
test(auth): add unit coverage for logoutCleanup branches (#24639) - #24657
markankamaransheogarat-sys wants to merge 1 commit into
Conversation
…#24639) Signed-off-by: amadeus <amadeusbackit@gmail.com>
✅ Deploy Preview for kubestellarconsole ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
File-overlap note: this PR and #24640 both add 🐝 Hive Agent: — hive: agent=scanner backend=copilot model=claude-fable-5 copilot=1.0.88 |
|
Heads-up for maintainers: this PR and #24640 both add 🐝 Hive Agent: — hive: agent=scanner backend=copilot model=claude-fable-5 copilot=1.0.88 |
There was a problem hiding this comment.
Decision needed: @clubanderson should decide whether to close this PR in favour of #24640, which adds the same logoutCleanup test file for #24639 and is green.
This duplicates #24640. Both PRs add the identical new file web/src/lib/auth/__tests__/logoutCleanup.test.ts for issue #24639, covering the same branches of invalidateServerSession() / clearLocalAuthStorage(); only one can merge. #24640 is earlier, all checks are green, and its PR body includes a mutation check. This PR adds one extra block (clearSessionCaches coverage) but has a failing Test (chromium, shard 2) check. I have not closed anything.
Beyond the duplication, this PR's module specifiers don't resolve. The test lives in web/src/lib/auth/__tests__/, but it imports and mocks paths relative to web/src/lib/auth/:
logoutCleanup.test.ts:40vi.mock('../authToken', …)resolves toweb/src/lib/auth/authToken, which does not exist — the real module isweb/src/lib/authToken.ts, i.e.../../authTokenfrom the test (compare #24640, which mocks../../authToken).- Same offset error for
../demoMode,../safeLocalStorage,../sseClient,../dashboards/dashboardSync, and../../hooks/*(should be../../../hooks/*); I verified against the tree —web/src/lib/auth/contains none of those modules. logoutCleanup.test.ts:100importsDEMO_TOKEN_VALUEetc.from '../constants', which also resolves to a nonexistentweb/src/lib/auth/constants.
Mechanism/consequence: the direct ../constants import cannot resolve, and the vi.mock registrations target ids that differ from the ones logoutCleanup.ts actually imports (../authToken from lib/auth/ = web/src/lib/authToken), so the mocks would not intercept even if resolution succeeded. The suite cannot run as written.
Recommendation: close in favour of #24640. If maintainers want the extra clearSessionCaches coverage, it would be a small follow-up on top of #24640's correctly-pathed file.
— hive: agent=reviewer backend=copilot model=claude-fable-5 copilot=1.0.88
|
Needs a decision, not a merge:
Head: verdict requires_human @10090f0, 31/31 checks green, DCO yes, soak 30m0s elapsed. What to do: a trusted merger approves this head ( Clear the cause and the hive re-evaluates on its next pass; the stage moves to |
1 similar comment
|
Needs a decision, not a merge:
Head: verdict requires_human @10090f0, 31/31 checks green, DCO yes, soak 30m0s elapsed. What to do: a trusted merger approves this head ( Clear the cause and the hive re-evaluates on its next pass; the stage moves to |
|
Closing this as a duplicate of #24640, which already covers the same logoutCleanup tests. Sorry for the noise! |
📌 Fixes
Fixes #24639
📝 Summary of Changes
Adds dedicated unit test coverage for
web/src/lib/auth/logoutCleanup.tsexercising branches ininvalidateServerSession(),clearLocalAuthStorage(), andclearSessionCaches().Changes Made
web/src/lib/auth/__tests__/logoutCleanup.test.tsinvalidateServerSession()skipping logout POST for absent or demo tokensinvalidateServerSession()sendingBearertoken andX-Requested-With: XMLHttpRequestinvalidateServerSession()gracefully swallowing network errorsclearLocalAuthStorage()clearing token stores, resetting demo flags, and wipingkc-auth-user-cacheandkc-session-idfrom sessionStorageclearLocalAuthStorage()handling environments wheresessionStoragethrowsclearSessionCaches()invoking cache clears and presence disconnectChecklist
git commit -s)