From 7ea4860202f14bad5d0733c736b2001e9cf54fb6 Mon Sep 17 00:00:00 2001 From: objz Date: Thu, 1 Oct 2026 22:58:09 +0200 Subject: [PATCH] style: trim redundant snapshot fixture comments --- src/tui/tests/widgets/instances.rs | 7 +------ src/tui/tests/widgets/popups/error/render.rs | 2 -- .../widgets/popups/import_modpack/render.rs | 10 +--------- .../widgets/popups/new_instance/render.rs | 20 ++----------------- 4 files changed, 4 insertions(+), 35 deletions(-) diff --git a/src/tui/tests/widgets/instances.rs b/src/tui/tests/widgets/instances.rs index 29253a1..55db4c5 100644 --- a/src/tui/tests/widgets/instances.rs +++ b/src/tui/tests/widgets/instances.rs @@ -8,9 +8,6 @@ fn format_relative_time_none_returns_never_played() { assert_eq!(format_relative_time(None), "Never played"); } -// each #[case] picks a "seconds ago" value that lands in exactly one -// bucket of the match. mutating any bucket boundary (e.g. 3600 to 3601, -// or "minutes" to "seconds") makes one of these cases fail. #[rstest::rstest] #[case::just_now(0, "Just now")] #[case::just_now_upper(59, "Just now")] @@ -33,9 +30,7 @@ use ratatui::Terminal; use ratatui::backend::TestBackend; fn synthetic_instance(name: &str) -> InstanceConfig { - // last_played intentionally None so the rendered text is the - // deterministic "Never played" string. anything else would make the - // snapshot drift relative to chrono::Utc::now(). + // Avoid clock-dependent snapshot text. InstanceConfig { name: name.to_string(), game_version: "1.20.1".to_string(), diff --git a/src/tui/tests/widgets/popups/error/render.rs b/src/tui/tests/widgets/popups/error/render.rs index c32878a..334023e 100644 --- a/src/tui/tests/widgets/popups/error/render.rs +++ b/src/tui/tests/widgets/popups/error/render.rs @@ -42,8 +42,6 @@ fn error_level_renders() { insta::assert_snapshot!(term.backend()); } -// info-level events hit the catch-all `_` arm in the label match; previously -// there was no test covering it. #[test] fn info_level_renders() { let term = render(event(Level::INFO, "Reloaded config"), 40, 5); diff --git a/src/tui/tests/widgets/popups/import_modpack/render.rs b/src/tui/tests/widgets/popups/import_modpack/render.rs index f169726..0a3316b 100644 --- a/src/tui/tests/widgets/popups/import_modpack/render.rs +++ b/src/tui/tests/widgets/popups/import_modpack/render.rs @@ -84,9 +84,7 @@ fn import_modpack_renders_fetching_step() { insta::assert_snapshot!(terminal.backend()); } -// Version step: pre-populate versions as LoadState::Loaded with synthetic -// VersionInfo entries so render walks the list path without triggering -// any network helpers. +// Loaded fixtures keep rendering from spawning network tasks. #[test] fn import_modpack_renders_version_step() { use crate::net::modrinth::VersionInfo; @@ -133,9 +131,6 @@ fn import_modpack_renders_version_step() { insta::assert_snapshot!(terminal.backend()); } -// Confirm step: needs a populated ImportSummary so the render path -// doesn't bail. ImportSummary is constructed manually with synthetic -// values; archive_path is a fake tempdir-ish path that never gets read. #[test] fn import_modpack_renders_confirm_step() { use crate::instance::import::{ImportSummary, PackFormat}; @@ -177,9 +172,6 @@ fn modpack_confirmation_area_fits_its_summary() { assert_eq!(popup_rect(Rect::new(0, 0, 100, 30)).height, 8); } -// Confirm step with loader_version=None: covers the branch where the -// pack didn't declare a loader version (rare upstream, but happens for -// older mmc packs). render_confirm_step has to handle the Option. #[test] fn import_modpack_renders_confirm_step_without_loader_version() { use crate::instance::import::{ImportSummary, PackFormat}; diff --git a/src/tui/tests/widgets/popups/new_instance/render.rs b/src/tui/tests/widgets/popups/new_instance/render.rs index c27225f..03ee517 100644 --- a/src/tui/tests/widgets/popups/new_instance/render.rs +++ b/src/tui/tests/widgets/popups/new_instance/render.rs @@ -6,10 +6,7 @@ use crate::tests::TEST_LOCK; use ratatui::Terminal; use ratatui::backend::TestBackend; -// WIZARD_STATE is a process-global static; without serialisation, parallel -// tests would race when each test sets the step and then renders, since -// render re-acquires the WIZARD_STATE mutex internally. this guard mutex -// ensures only one wizard snapshot test runs at a time. +// Render re-acquires WIZARD_STATE, so TEST_LOCK guards setup and rendering together. fn reset_wizard_state(step: WizardStep) { let mut guard = WIZARD_STATE.lock().expect("WIZARD_STATE lock"); *guard = WizardState::default(); @@ -19,7 +16,6 @@ fn reset_wizard_state(step: WizardStep) { #[test] fn new_instance_renders_name_step() { let _serial = TEST_LOCK.lock().unwrap_or_else(|e| e.into_inner()); - // Name is the default step; render touches no network helpers. reset_wizard_state(WizardStep::Name); let backend = TestBackend::new(60, 12); @@ -33,8 +29,6 @@ fn new_instance_renders_name_step() { #[test] fn new_instance_renders_loader_step() { let _serial = TEST_LOCK.lock().unwrap_or_else(|e| e.into_inner()); - // Loader step is reached after Name; render just paints the hardcoded - // loader list, no network. reset_wizard_state(WizardStep::Loader); let backend = TestBackend::new(60, 12); @@ -45,10 +39,7 @@ fn new_instance_renders_loader_step() { insta::assert_snapshot!(terminal.backend()); } -// Version step: pre-populate versions as LoadState::Loaded so -// ensure_versions_loaded short-circuits and never spawns a network task. -// the three synthetic versions are marked stable=true so they show with -// show_snapshots=false (the default). +// Loaded fixtures keep rendering from spawning network tasks. #[test] fn new_instance_renders_version_step() { use crate::instance::loader::GameVersion; @@ -82,9 +73,6 @@ fn new_instance_renders_version_step() { insta::assert_snapshot!(terminal.backend()); } -// LoaderVersion step: needs both versions and loader_versions pre-loaded. -// pick a non-Vanilla loader (loader_idx=2 = Forge) so the step doesn't -// skip itself to Confirm. #[test] fn new_instance_renders_loader_version_step() { use crate::instance::loader::GameVersion; @@ -111,8 +99,6 @@ fn new_instance_renders_loader_version_step() { insta::assert_snapshot!(terminal.backend()); } -// Confirm step: paints a summary, no network, no list. requires -// versions + loader_versions Loaded so selected_*() return Some. #[test] fn new_instance_renders_confirm_step() { use crate::instance::loader::GameVersion; @@ -129,8 +115,6 @@ fn new_instance_renders_confirm_step() { stable: true, }]); guard.loader_versions = LoadState::Loaded(vec!["0.15.0".into()]); - // TextState exposes only constructors; rebuilding with the - // desired initial value is the supported path. guard.name_state = TextState::new().with_value("MyPack"); }