testing

Guides writing and running Rust tests for GRID Craft Launcher using nextest, wiremock, and insta.

Updated Sep 8, 2026
One-click install
npx skills add https://github.com/Sixdd6/grid-craft-launcher --skill testing-sixdd6
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: testing
Source: https://github.com/Sixdd6/grid-craft-launcher/tree/main/.claude/skills/testing
Command: npx skills add https://github.com/Sixdd6/grid-craft-launcher --skill testing-sixdd6

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? It gives contributors a single reference for how to test the GRID Craft Launcher codebase correctly, covering unit tests, HTTP mocking, snapshot review, CLI tests, GUI flow tests, and end-to-end recipes, so tests stay hermetic and CI-safe. ## Core Features & Use Cases - Test commands and workflow: Run just check for fmt, clippy, and all tests, filter with nextest syntax, and review insta snapshots before CI fails. - HTTP mocking patterns: Point Mojang, Modrinth, CurseForge, loader, and Microsoft auth endpoints at wiremock servers using debug-only GCL_*_BASE_URL overrides or Launcher::open_with_endpoints. - Test doubles and fixtures: Use FakeSource, FakeRunner, MemoryStore, recorded JSON fixtures with host rewriting, and shared helpers in tests/common/mod.rs. - GUI and e2e testing: Drive the Slint UI through the testing backend with flow tests, run just e2e / just e2e-modpack for real-network checks, and use just ui-xtest for real X input. - Use Case: When adding a new content-source feature, read this Skill to build a wiremock-backed test with a trimmed fixture and an insta snapshot instead of hitting the real network. ## Quick Start Ask the assistant to read the testing skill and then write a wiremock-based unit test for a new Modrinth source function following the project's fixture and snapshot conventions.

Frequently Asked Questions about testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run tests for this Rust launcher project?▼

Run `just check` to execute fmt, clippy, and the full test suite via nextest. To run a single test, use `just test 'test(name)'` with nextest filter syntax such as `test(substring)` or `package(gcl-core)`.

How do I mock HTTP requests in Rust tests with wiremock?▼

Start a `MockServer`, mount `Mock` responses for each path, and point the client at the server using `with_base_url` constructors or the debug-only `GCL_*_BASE_URL` environment overrides. Release builds ignore these overrides, so use `Launcher::open_with_endpoints` there.

How do I test the Slint GUI without opening a display?▼

Use the flow tests in `crates/gcl-ui/tests/`, which build a real `AppWindow` on the Slint testing backend with no display. The `TestApp` harness provides click, type, and wait helpers, with one backend per test binary process.

Can unit or CLI tests make real network requests?▼

No. Unit and CLI tests must never touch the network; every endpoint is mocked with wiremock or pointed at an unreachable `.invalid` host. Only the `just e2e` scripts and `just ui-xtest` use the real network, and they are run manually.

Why does the snapshot test fail in CI?▼

Pending insta snapshots fail CI when the rendered output changes. Run `cargo insta review` locally to accept or reject each snapshot change, then commit the updated snapshot files with your change.

How do I test the Microsoft login flow without real credentials?▼

Build an `MsaEndpoints` struct pointing all six steps at one wiremock `MockServer` and use a `MemoryStore` as the secret store so no real keyring is touched. A recording sleep function drives the device-code poll loop without real waiting.