test: golden-file tests for M3U output (#11) #29

Merged
timothy merged 1 commits from foundations/11-golden-tests into main 2026-06-27 10:22:28 +02:00
Owner

Refs #11. Golden-file tests that lock the M3U output shape Jellyfin/Kodi consume (ChannelPlaylist.ToM3U) — the direct regression net for the paused #1 (tvg-logo base URL). Baselines capture today's output, so any change to the M3U contract fails CI.

Scenarios (6)

simple channel (generated logo) · internal-artwork logo (/iptv/logos/{path}.jpg) · external-URL logo (used as-is) · multi-channel (sorted by number) · Kodi user-agent (KODIPROP lines) · base-URL + access-token threading.

Design

  • Deterministic: fixed UniqueIds; a [SetUp] guard Assumes ETV_INSTANCE_ID is unset (it feeds tvg-id via ChannelIdentifier.FromNumber) — skips rather than falsely failing.
  • Golden files committed under Iptv/Goldens/, located via [CallerFilePath] (resolve from the checked-out source in CI and locally; no embedded-resource plumbing). Line endings normalized on both sides.
  • Regenerate after an intentional change via the [Explicit] Regenerate_goldens test or ETV_UPDATE_GOLDENS=1.

Verification

  • 6/6 pass; full-solution Release build 0/0.
  • Proven to have teeth: tampering a golden made its test fail (then reverted → green).

Scope

M3U (the #1-critical surface) lands here. XMLTV guide + channel-logo image golden coverage is split to #28 — the XMLTV handler needs DB + fake-filesystem fixtures (it only assembles pre-built fragments), and the SkiaSharp logo image isn't byte-deterministic across platforms. Happy to fold those in here instead if you'd prefer #11 cover all three in one go.

Refs #11. Golden-file tests that lock the **M3U** output shape Jellyfin/Kodi consume (`ChannelPlaylist.ToM3U`) — the direct regression net for the paused **#1** (tvg-logo base URL). Baselines capture **today's** output, so any change to the M3U contract fails CI. ## Scenarios (6) simple channel (generated logo) · internal-artwork logo (`/iptv/logos/{path}.jpg`) · external-URL logo (used as-is) · multi-channel (sorted by number) · Kodi user-agent (KODIPROP lines) · base-URL + access-token threading. ## Design - **Deterministic**: fixed `UniqueId`s; a `[SetUp]` guard `Assume`s `ETV_INSTANCE_ID` is unset (it feeds `tvg-id` via `ChannelIdentifier.FromNumber`) — skips rather than falsely failing. - **Golden files** committed under `Iptv/Goldens/`, located via `[CallerFilePath]` (resolve from the checked-out source in CI and locally; no embedded-resource plumbing). Line endings normalized on both sides. - **Regenerate** after an intentional change via the `[Explicit] Regenerate_goldens` test or `ETV_UPDATE_GOLDENS=1`. ## Verification - 6/6 pass; full-solution Release build 0/0. - **Proven to have teeth**: tampering a golden made its test fail (then reverted → green). ## Scope M3U (the #1-critical surface) lands here. **XMLTV guide + channel-logo image** golden coverage is split to **#28** — the XMLTV handler needs DB + fake-filesystem fixtures (it only assembles pre-built fragments), and the SkiaSharp logo image isn't byte-deterministic across platforms. Happy to fold those in here instead if you'd prefer #11 cover all three in one go.
timothy force-pushed foundations/11-golden-tests from 44e8025975 to 194d3fdf34 2026-06-27 10:19:00 +02:00 Compare
timothy merged commit 194d3fdf34 into main 2026-06-27 10:22:28 +02:00
timothy deleted branch foundations/11-golden-tests 2026-06-27 10:22:28 +02:00
Sign in to join this conversation.