8 Commits
Author SHA1 Message Date
objz 3479a05e63 test: observe partial downloads through file contents on Windows 2026-10-02 00:18:53 +02:00
objz 7362354109 fix: make filesystem writes and downloads cancellation-safe 2026-10-01 23:21:13 +02:00
objz 3149b96971 fix: verify downloads and bound imported metadata 2026-10-01 17:44:06 +02:00
objz 783fb76f06 style: remove redundant code narration 2026-10-01 13:53:12 +02:00
objz 29ad70fa16 chore: add SPDX copyright headers 2026-08-24 19:13:43 +02:00
objz d488954548 fix(content): bound remote resource usage 2026-08-04 21:02:35 +02:00
objz dc13746841 test(net): make retry and loader coverage deterministic 2026-07-27 01:10:04 +02:00
objz 623acd9e2c added: tests for retry envelope, manager rename, mod precedence, time buckets
Audit identified six high-priority coverage gaps. This commit closes
them with 30 net new passing tests.

- tests/net_retry.rs (new): 5 wiremock-based tests for the retry
  envelope in net/mod.rs. Covers get_json + download_file across:
  5xx retry-then-succeed, 4xx fail-fast (asserted via wiremock
  expect(1) so any retry attempt fails the test), and exhaust at
  MAX_RETRIES = 3 (asserted via expect(4)). The exhaust test takes
  ~3.5s of wall time because the production code sleeps 500 + 1000 +
  2000 ms between attempts; this is unavoidable without making the
  delays configurable.

- tests/launch_pipeline.rs: 3 new error-path tests against
  build_launch_invocation. merged_profile_missing_main_class_fails
  surfaces the LaunchError::Parse branch when meta.json deserialises
  cleanly but lacks mainClass. legacy_loader_profile_missing_loader_version_errors
  and legacy_loader_profile_missing_installer_json_errors exercise the
  two Parse branches inside migrate_legacy_loader_profile_if_needed.

- instance/manager.rs: 6 tests for rename (happy path, noop on same
  name, empty target rejected, missing source, target collision) and
  touch_last_played (sets the field to a stamp within 5 seconds of
  now). The InstanceManager rename surface had no coverage before;
  mutating the validation order or the std::fs::rename target would
  not have failed any existing test.

- instance/content/mods.rs: 4 new precedence-chain tests. The reader
  chain is fabric > quilt > forge-toml (which itself tries
  neoforge.mods.toml before mods.toml) > mcmod.info. Only the
  fabric-over-forge precedence had a test before. Adds quilt > forge,
  forge_toml > mcmod_info, neoforge.mods.toml > mods.toml, and a test
  that a mods.toml carrying only logoFile (no [[mods]] array) still
  resolves the icon.

- tui/widgets/instances.rs: 12 new tests for format_last_played. One
  case for the None input (returns "Never played"), then an rstest
  covering each bucket boundary in the match (0/59 just-now,
  60/3599 minutes, 3600/86399 hours, 86400/2591999 days,
  2592000/31535999 months, >=31536000 over-a-year). A mutation that
  bumps any boundary by one second, or swaps a unit suffix, fails at
  least one case.
2026-05-27 16:44:05 +02:00