Skip to content

test(coverage): Batch 1 — RadioGroup, Tabs, factoryResetService#132

Merged
qnbs merged 2 commits into
mainfrom
test/coverage-batch-1
Jun 14, 2026
Merged

test(coverage): Batch 1 — RadioGroup, Tabs, factoryResetService#132
qnbs merged 2 commits into
mainfrom
test/coverage-batch-1

Conversation

@qnbs

@qnbs qnbs commented Jun 14, 2026

Copy link
Copy Markdown
Owner

User description

Summary

Coverage lift Batch 1 (plan #3 / TODO v1.23 P1). Three previously-0% modules now have deterministic unit tests. Targets were chosen from the CI V8 per-file branch report harvested from the #131 Quality Gate (baseline B63.15), not from a heuristic.

Module Was Tests Covers
components/ui/RadioGroup.tsx 0% 6 radiogroup role + aria-label, checked state, onChange(value), disabled option, vertical/horizontal orientation
components/ui/Tabs.tsx (Tabs + TabPanel) 0% 8 tablist/tab roles, aria-selected, onChange(id), disabled tab, pills/underline variant, data-state, panel show/hide + aria wiring
services/factoryResetService.ts 0% 3 wipeAllAppData: web-storage clear, IDB deletion, databases()-fails fallback branch, Cache API branch, reload

Also closes the long-standing "add unit tests for RadioGroup/Tabs" item from the v1.20 UI-Modernization list.

Notes

  • Pure test-only PR — no source changes.
  • jsdom + fake-indexeddb/auto; factoryResetService uses real timers (300 ms settle) and a scoped window.location.reload stub.
  • Storybook stories for the two atoms are intentionally out of scope here (kept to coverage) — tracked as a follow-up.

Gates

  • lint ✅ (1328 files) · typecheck ✅ · 17 new tests ✅ (full coverage delta verified by CI)

🤖 Generated with Claude Code


CodeAnt-AI Description

Add unit coverage for RadioGroup, Tabs, and app reset behavior

What Changed

  • Added tests for RadioGroup to verify labels and descriptions show up, the selected option is marked correctly, disabled options cannot be chosen, and vertical/horizontal layouts render as expected
  • Added tests for Tabs and TabPanel to verify tab roles, active state, disabled tabs, tab switching, variant styling, and panel show/hide behavior
  • Added tests for app reset behavior to verify local storage, session storage, browser databases, and service-worker caches are cleared before the page reloads, including the fallback path when database listing fails

Impact

✅ Fewer regressions in radio and tab controls
✅ Safer app reset flow
✅ Clearer coverage for storage and cache cleanup

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

#3 coverage lift — three previously-0% modules now tested (targets chosen from the CI V8
per-file branch report, baseline B63.15):
- components/ui/RadioGroup.tsx — radiogroup role/label, checked state, onChange, disabled,
  orientation (6 tests).
- components/ui/Tabs.tsx — Tabs + TabPanel: tablist/tab roles, aria-selected, onChange,
  disabled, variants, panel visibility (8 tests).
- services/factoryResetService.ts — wipeAllAppData: web-storage clear, IDB deletion,
  databases() fallback branch, Cache API branch, reload (3 tests).

Gates: lint OK (1328 files) | typecheck OK | 17 new tests pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@codeant-ai

codeant-ai Bot commented Jun 14, 2026

Copy link
Copy Markdown

CodeAnt AI is reviewing your PR.


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@qnbs

qnbs commented Jun 14, 2026

Copy link
Copy Markdown
Owner Author

@CodeAnt-AI review

@vercel

vercel Bot commented Jun 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
storycraft-studio Ready Ready Preview, Comment Jun 14, 2026 11:37am

@codeant-ai

codeant-ai Bot commented Jun 14, 2026

Copy link
Copy Markdown

CodeAnt AI is running the review.


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@codeant-ai codeant-ai Bot added the size:L This PR changes 100-499 lines, ignoring generated files label Jun 14, 2026
Comment thread tests/unit/factoryResetService.test.ts Outdated
@codeant-ai

codeant-ai Bot commented Jun 14, 2026

Copy link
Copy Markdown

CodeAnt AI finished reviewing your PR.

…132)

Replace the real 300ms reload-settle wait with vi.useFakeTimers() + runAllTimersAsync() (also
flushes fake-indexeddb deletion scheduling), making the suite deterministic and ~8x faster
(136ms vs ~1s). Addresses the CodeAnt minor suggestion.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@qnbs

qnbs commented Jun 14, 2026

Copy link
Copy Markdown
Owner Author

@CodeAnt-AI review

@codeant-ai

codeant-ai Bot commented Jun 14, 2026

Copy link
Copy Markdown

CodeAnt AI is running the review.


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@codeant-ai codeant-ai Bot added size:L This PR changes 100-499 lines, ignoring generated files and removed size:L This PR changes 100-499 lines, ignoring generated files labels Jun 14, 2026
@codeant-ai

codeant-ai Bot commented Jun 14, 2026

Copy link
Copy Markdown

Sequence Diagram

This diagram summarizes how the factory reset service deletes IndexedDB databases (with a fallback when listing fails), clears service worker caches and web storage, waits briefly, and then reloads the app, which is the main behavior covered by the new tests.

sequenceDiagram
    participant App
    participant FactoryResetService
    participant IndexedDB
    participant Caches
    participant WebStorage
    participant Browser

    App->>FactoryResetService: Trigger factory reset
    FactoryResetService->>IndexedDB: Delete all app databases
    alt databases listing works
        IndexedDB-->>FactoryResetService: Return databases to delete
    else listing fails
        FactoryResetService->>IndexedDB: Delete known database names
    end
    FactoryResetService->>Caches: Clear service worker caches if available
    FactoryResetService->>WebStorage: Clear local and session storage
    FactoryResetService->>FactoryResetService: Wait for short settle delay
    FactoryResetService->>Browser: Reload page
Loading

Generated by CodeAnt AI

@codeant-ai

codeant-ai Bot commented Jun 14, 2026

Copy link
Copy Markdown

CodeAnt AI finished running the review.


Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@qnbs
qnbs merged commit 19aac8c into main Jun 14, 2026
26 of 27 checks passed
@qnbs
qnbs deleted the test/coverage-batch-1 branch June 14, 2026 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant