feat: add comprehensive test suite with Vitest and Playwright#16
Merged
feat: add comprehensive test suite with Vitest and Playwright#16
Conversation
Add testing infrastructure for the application: - Configure Vitest with separate configs for main and renderer processes - Add React Testing Library for component testing - Set up Playwright for E2E testing - Create test setup files with mocks for Electron APIs Test coverage includes: - Renderer hooks: useDebounce, useKeyboardEvent, useKeyboardShortcuts - Contexts: Settings, Theme, Update, Breadcrumb - Components: DataTable, NewPatientForm - Main process: repository tests (structure only, requires Electron env) - Integration tests (structure only, requires Electron env) - E2E tests with Playwright (skipped by default) Update CI workflow to run tests before build.
- Fix activity.test.ts: use camelCase properties (entityType, surgeryId) and
correct action types ('created'/'updated' instead of 'create'/'update')
- Fix patient.test.ts: use correct schema (phn, birth_year, gender)
- Fix dashboard.test.ts: use correct patient/surgery schema
- Fix surgery.test.ts: use correct schema (title, bht, ward instead of procedure)
- Fix surgery-template.test.ts: use title instead of name
- Fix app-settings.test.ts: handle possibly undefined results
- Fix backup.test.ts: add type annotation for array
- Fix NewPatientForm.test.tsx: use Date objects for created_at/updated_at
- Fix renderer-setup.ts: import beforeEach from vitest
- Update tsconfig.web.json: add jest-dom types
- Update CI workflow: run tests after lint and typecheck
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Test Coverage
Renderer Tests (98 tests):
useDebounce(7),useKeyboardEvent(11),useKeyboardShortcuts(13)SettingsContext(4),ThemeContext(14),UpdateContext(13),BreadcrumbContext(6)DataTable(15),NewPatientForm(14)Main Process Tests (structure only):
Integration Tests (structure only):
E2E Tests (skipped by default):
Notes
Main process and integration tests cannot run with regular Node.js due to
better-sqlite3being compiled for Electron's Node version. These tests are structurally correct but require an Electron test environment to execute.Test plan
pnpm test:runpasses (98 tests)pnpm lintpassespnpm typecheckpasses