Skip to content

feat: add comprehensive test coverage for various components and utilities#23

Merged
Crauzer merged 4 commits intomainfrom
add-backend-tests
Feb 28, 2026
Merged

feat: add comprehensive test coverage for various components and utilities#23
Crauzer merged 4 commits intomainfrom
add-backend-tests

Conversation

@Crauzer
Copy link
Member

@Crauzer 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.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 api wrapper.
  • 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.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@Crauzer Crauzer merged commit 4113b7b into main Feb 28, 2026
5 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in LTK Manager Feb 28, 2026
@Crauzer Crauzer deleted the add-backend-tests branch February 28, 2026 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants