Skip to content

Phase 2: Add component tests for all 8 shared frontend components#412

Merged
payamnj merged 3 commits intomasterfrom
copilot/continue-tasks-from-session
May 5, 2026
Merged

Phase 2: Add component tests for all 8 shared frontend components#412
payamnj merged 3 commits intomasterfrom
copilot/continue-tasks-from-session

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 5, 2026

  • Phase 1: Vitest test infrastructure (merged in PR PR 1: Add Vitest test infrastructure for frontend #409)
  • Phase 2: Component tests for src/components/ — 64 tests, all passing, 0 errors
    • src/__mocks__/render.jsx — manual mock (explicit vi import)
    • src/test/setup.js — fixed: getClientRects/getBoundingClientRect stubs are now plain functions, not vi.fn(), so vi.clearAllMocks() in beforeEach doesn't reset them (was causing 1 unhandled error in CI)
    • RequiredTextField.test.jsx
    • ThemeSwitcher.test.jsx
    • BottomDrawer.test.jsx
    • FileUpload.test.jsx
    • ImageUpload.test.jsx
    • MenuBar.test.jsx
    • ContentEditor.test.jsx
    • Base.test.jsx

@payamnj
Copy link
Copy Markdown
Contributor

payamnj commented May 5, 2026

@copilot the frontend test failed

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 5, 2026

@copilot the frontend test failed

Fixed in commit 3bdb6a1. The root cause was that the getClientRects/getBoundingClientRect stubs in setup.js were created with vi.fn(), so vi.clearAllMocks() in beforeEach wiped their implementations after the first test — leaving ProseMirror's scroll logic calling undefined() and throwing an unhandled error (exit code 1).

Changed those stubs to plain functions so clearAllMocks leaves them intact. All 64 tests now pass with 0 errors.

Copilot finished work on behalf of payamnj May 5, 2026 12:27
@payamnj payamnj marked this pull request as ready for review May 5, 2026 12:29
@payamnj payamnj merged commit c5831ec into master May 5, 2026
8 checks passed
Copilot stopped work on behalf of payamnj due to an error May 5, 2026 12:30
Copilot stopped work on behalf of payamnj due to an error May 5, 2026 12:31
@payamnj payamnj deleted the copilot/continue-tasks-from-session branch May 5, 2026 12:32
Copilot stopped work on behalf of payamnj due to an error May 5, 2026 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants