feat: add comprehensive test coverage for various components and utilities#23
Merged
feat: add comprehensive test coverage for various components and utilities#23
Conversation
Member
Crauzer
commented
Feb 28, 2026
- Introduced unit tests for the library filter, notifications, and patcher session stores.
- Added tests for error handling utilities and query functions.
- Implemented mock setups for Tauri API interactions.
- Created fixtures for settings and installed mods to streamline testing.
- Configured Vitest for testing environment with coverage reporting.
…ities - Introduced unit tests for the library filter, notifications, and patcher session stores. - Added tests for error handling utilities and query functions. - Implemented mock setups for Tauri API interactions. - Created fixtures for settings and installed mods to streamline testing. - Configured Vitest for testing environment with coverage reporting.
There was a problem hiding this comment.
Pull request overview
This PR introduces a frontend Vitest testing setup (with mocks/fixtures) and adds a broad set of unit tests across both the TypeScript frontend utilities/stores and the Rust Tauri backend modules, along with CI updates to run the new test suite.
Changes:
- Added Vitest configuration (jsdom + globals) plus test setup, fixtures, and Tauri API mocks for frontend tests.
- Implemented new TypeScript unit tests for result/query/error helpers, stores, and the Tauri
apiwrapper. - Added Rust unit tests across workshop/mods/overlay/patcher/error/state modules and introduced Rust dev-dependencies to support them; updated CI to run frontend tests.
Reviewed changes
Copilot reviewed 27 out of 30 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
vitest.config.ts |
Adds Vitest config (aliasing, jsdom env, setup file, and coverage settings). |
src/utils/result.test.ts |
Unit tests for Result helpers (unwrap/map/match, etc.). |
src/utils/query.test.ts |
Unit tests for TanStack Query wrappers (queryFn, mutationFn, etc.). |
src/utils/errors.test.ts |
Unit tests for error-code helpers and context parsing. |
src/test/utils.tsx |
Adds a React Query + Testing Library render helper for component tests. |
src/test/setup.ts |
Registers Testing Library jest-dom matchers for Vitest. |
src/test/mocks/tauri.ts |
Adds Vitest mocks for Tauri core/event and common plugins. |
src/test/globals.d.ts |
Enables Vitest globals typings for the TS test environment. |
src/test/fixtures.ts |
Adds frontend fixtures for settings/mods/profiles to simplify tests. |
src/stores/patcherSession.test.ts |
Adds tests for the patcher session store behavior. |
src/stores/notifications.test.ts |
Adds tests for notifications store behavior (unread count, cap, dismiss). |
src/stores/libraryFilter.test.ts |
Adds tests for library filter store toggles and reset behavior. |
src/lib/tauri.test.ts |
Adds tests ensuring IPC wrappers call the expected Tauri commands + args. |
src-tauri/src/workshop/projects.rs |
Adds Rust unit tests for GitHub URL parsing and WAD filename detection. |
src-tauri/src/workshop/packing.rs |
Adds Rust unit tests around project validation and pack format parsing. |
src-tauri/src/workshop/mod.rs |
Adds Rust unit tests for project name validation and config-file discovery. |
src-tauri/src/workshop/layers.rs |
Adds Rust unit tests around layer config persistence scenarios. |
src-tauri/src/state.rs |
Adds Rust unit tests for Settings defaults and (de)serialization. |
src-tauri/src/patcher/mod.rs |
Adds Rust unit tests for patcher state defaults and phase serialization. |
src-tauri/src/overlay/mod.rs |
Adds Rust unit tests for game-dir resolution and overlay progress serialization. |
src-tauri/src/overlay/fantome_content.rs |
Adds Rust unit tests for Fantome ZIP parsing and WAD listing/overrides behavior. |
src-tauri/src/mods/mod.rs |
Adds Rust unit tests for profile slugging, index helpers, and path resolution. |
src-tauri/src/mods/migration.rs |
Adds Rust unit tests for CSLOL migration scanning + zip creation helpers. |
src-tauri/src/mods/library.rs |
Adds Rust unit tests for installed mod reading and Fantome metadata/thumbnail extraction. |
src-tauri/src/error.rs |
Adds Rust unit tests for error-code serialization and IPC result wrappers. |
src-tauri/Cargo.toml |
Adds Rust dev-dependencies (tempfile, assert_matches) for tests. |
Cargo.lock |
Locks new Rust dev-dependencies. |
package.json |
Adds Vitest scripts and dependencies; includes tests in check. |
pnpm-lock.yaml |
Locks new JS testing dependencies (vitest, jsdom, testing-library, coverage provider). |
.github/workflows/ci.yml |
Adds a separate frontend test job to run pnpm test. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Removed the frontend test job from the CI workflow. - Updated mock data in fixtures to use fixed dates for consistency. - Refactored project validation logic to improve error handling and streamline checks for project structure and layer integrity. - Added new functions for creating, deleting, updating, and reordering layers in workshop projects.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 26 out of 29 changed files in this pull request and generated 2 comments.
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Added 'vitest.config.ts' to the TypeScript configuration include paths. - Refactored the TestProviders component to use useState for the QueryClient, improving performance and state management in tests.
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.