src-tauri/ contained no HTTP mocking of any kind. Every test of the ~4,800-line
online adapter asserted on a constructed URL string; not one exercised a
response. So "works against both server generations" was not merely untested, it
was unfalsifiable.
Adds wiremock (a project dev-dependency, so no CI image change — the toolchain
rule is about system packages) and a FakeJellyfin fixture that reports a chosen
version. The repository it hands back resolves its capabilities from exactly that
string via the production path, so a test running against both generations is
running the real resolution rather than a stubbed one.
Eight cross-generation tests, each asserting on what the client actually put on
the wire or did with a response it actually received:
- every request carries Authorization: MediaBrowser and no X-Emby-Authorization
- a listing parses into domain items on both generations
- a type-filtered listing puts Recursive on the wire
- libraries resolve through the user-scoped route on both
- flipping user_scoped_item_routes really changes the request and still parses,
so the alternative shape is exercised rather than being untested code waiting
to be switched on
- favourites send Filters=IsFavorite and omit the type filter under All scope
- player-facing URLs carry ApiKey= and never api_key=
- capabilities come from the version the server reported
The auth test was verified to fail when the legacy header is reintroduced into
get_json_inner, so it is a guard rather than decoration.
HttpClient keeps https_only(true) in production; a #[cfg(test)] constructor
allows the plaintext loopback wiremock serves. Weakening the real one to make
testing possible would trade the thing that stops a downgrade putting a session
token in clear for the thing meant to protect it.
The rule this module states and follows: assert against a response from a mock
server, never against a mock that re-derives the thing under test. That is the
mistake the deleted online_integration_test.rs made, and it shipped a broken
download endpoint while staying green.
TRACES: UR-085 | DR-281 | IT-019, IT-020, IT-021, IT-022, IT-023, IT-024, IT-025, IT-026
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>