Skip to content

fix: add missing mocks for auth test dependencies (#5418)#5422

Merged
clubanderson merged 1 commit intomainfrom
fix/auth-test-failures
Apr 8, 2026
Merged

fix: add missing mocks for auth test dependencies (#5418)#5422
clubanderson merged 1 commit intomainfrom
fix/auth-test-failures

Conversation

@clubanderson
Copy link
Copy Markdown
Collaborator

Summary

Closes #5418

Test plan

  • npx vitest run src/lib/__tests__/auth-expand.test.ts -- 35/35 pass (was 14 failures)
  • npx vitest run src/lib/__tests__/auth.test.ts -- 61/61 pass (was 36 failures)
  • Full test suite: 13,865 tests pass, 0 test failures (only OOM worker crashes on large suite)

PR #5412 added clearClusterCacheOnLogout (from hooks/mcp/shared),
clearPermissionsCache, disconnectPresence, and clearSSECache imports
to auth.tsx. The auth tests did not mock these new dependencies,
causing 50 test failures. The demoMode mock also lacked exports
(isNetlifyDeployment, isDemoMode, isDemoToken, subscribeDemoMode)
that hooks/mcp/shared requires at module load time.

Closes #5418

Signed-off-by: Andrew Anderson <[email protected]>
Copilot AI review requested due to automatic review settings April 8, 2026 07:29
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Apr 8, 2026
@kubestellar-prow
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign mikespreitzer for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 8, 2026

Deploy Preview for kubestellarconsole ready!

Name Link
🔨 Latest commit 3fd5afe
🔍 Latest deploy log https://app.netlify.com/projects/kubestellarconsole/deploys/69d603f52c09f90008831be8
😎 Deploy Preview https://deploy-preview-5422.console-deploy-preview.kubestellar.io
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@clubanderson clubanderson merged commit 0fb6124 into main Apr 8, 2026
17 of 18 checks passed
@kubestellar-prow kubestellar-prow Bot deleted the fix/auth-test-failures branch April 8, 2026 07:30
@kubestellar-prow kubestellar-prow Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Apr 8, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 8, 2026

👋 Hey @clubanderson — thanks for opening this PR!

🤖 This project is developed exclusively using AI coding assistants.

Please do not attempt to code anything for this project manually.
All contributions should be authored using an AI coding tool such as:

This ensures consistency in code style, architecture patterns, test coverage,
and commit quality across the entire codebase.


This is an automated message.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 8, 2026

Thank you for your contribution! Your PR has been merged.

Check out what's new:

Stay connected: Slack #kubestellar-dev | Multi-Cluster Survey

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes Vitest failures introduced after auth.tsx started importing additional cleanup/cache modules by adding the missing vi.mock declarations and expanding the existing demoMode mock to include exports required during module initialization.

Changes:

  • Extend the ../demoMode test mock with additional exports (isNetlifyDeployment, isDemoMode, isDemoToken, subscribeDemoMode).
  • Add missing mocks for newly imported auth dependencies: hooks/mcp/shared, hooks/usePermissions, hooks/useActiveUsers, and lib/sseClient.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
web/src/lib/__tests__/auth.test.ts Adds missing mocks so auth.tsx and its transitive imports can load in tests without pulling in real cache/side-effect modules.
web/src/lib/__tests__/auth-expand.test.ts Mirrors the same missing mocks/exports to stabilize the expanded auth test suite.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 8, 2026

Post-merge build verification passed

Both Go and frontend builds compiled successfully against merge commit 0fb61241473d7e9a231f2d65aec8e87cc1d4476a.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 8, 2026

✅ Post-Merge Verification: passed

Commit: 0fb61241473d7e9a231f2d65aec8e87cc1d4476a
Specs run: smoke.spec.ts
Report: https://github.com/kubestellar/console/actions/runs/24123455462

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has signed the DCO. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 50 test failure(s) in Coverage Suite run #343

2 participants