[scanner] fix: stale test assertions in compliance component#20568
Conversation
…ests Restore correct mocking so compliance component tests exercise real component behaviour rather than the global authFetch safety-net stub. Root causes (all introduced after the tests were written): - Jul 6 2026 (#20384): setup.ts added a global vi.mock('../lib/api') stub whose authFetch returns '{}' for every call. Tests that spy on globalThis.fetch stopped working because authFetch never reaches globalThis.fetch when a module-level mock intercepts it first. Affected: ChangeControlAudit, DataResidency, SegregationOfDuties. Fix: each file now declares vi.mock('../../lib/api') with an authFetch that delegates to globalThis.fetch, overriding the global stub and letting the existing vi.spyOn(globalThis, 'fetch') mocks work as before. - Jul 4 2026 (#20300): ComplianceDrillDown.tsx gained a useDrillDown() call (back-navigation feature) that throws when rendered outside a DrillDownProvider. Neither ComplianceDrillDown test file mocked it. Fix: added vi.mock for useDrillDown returning a minimal stub in both views/ComplianceDrillDown.test.tsx and views/__tests__/ComplianceDrillDown.test.tsx. - SpiffeStatus component accesses data.stats.* and data.summary.* but the test setup() fixture only provided health/entries/federatedDomains, causing TypeError on the 'renders without error when data is loaded' test. Fix: added stats, summary, and lastCheckTime to the mock data object. Fixes #20555 Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: scanner-bot <scanner-bot@kubestellar.io>
✅ Deploy Preview for kubestellarconsole ready!
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 |
|
👋 Hey @kubestellar-hive[bot] — thanks for opening this PR!
This is an automated message. |
✅ Test Coverage CheckAll new source files in this PR have corresponding test files. Checked |
♿ Accessibility Audit (WCAG 2.1 AA)✅ No WCAG 2.1 AA violations detected in audited routes. Powered by axe-core. Target: WCAG 2.1 AA compliance. |
❌ Playwright Tests Failed📊 View Full ReportDownload the To view the report locally: # Download and extract playwright-report.zip
npx playwright show-report path/to/playwright-report |
The failing test (e2e/oauth-flow.spec.ts - completes full OAuth chain) is unrelated to the compliance component changes in this PR. Retriggering to get a clean run. Signed-off-by: Scanner Bot <scanner@hive.local>
❌ Playwright Tests Failed📊 View Full ReportDownload the To view the report locally: # Download and extract playwright-report.zip
npx playwright show-report path/to/playwright-report |
|
Thank you for your contribution! Your PR has been merged. Check out what's new:
Stay connected: Slack #kubestellar-dev | Multi-Cluster Survey |
✅ Post-Merge Verification: passedCommit: |
|
Post-merge build verification passed ✅ Both Go and frontend builds compiled successfully against merge commit |
Fixes #20555
Updates stale test assertions in compliance component tests across 6 test files.