From 7f17cfe439a410d1c3967188cb2e1c1a3435f6fa Mon Sep 17 00:00:00 2001 From: funman300 Date: Fri, 21 Aug 2026 21:00:25 +0000 Subject: [PATCH] test(host): name the catalog-card fixture instead of a six-tuple clippy::type_complexity, and the struct reads better at the call site: the fixture rows now say which field is the subtype and which is the art id. --- openfut-utas-host/tests/host_test.rs | 51 ++++++++++++++++++++-------- 1 file changed, 36 insertions(+), 15 deletions(-) diff --git a/openfut-utas-host/tests/host_test.rs b/openfut-utas-host/tests/host_test.rs index 7012298..15caf23 100644 --- a/openfut-utas-host/tests/host_test.rs +++ b/openfut-utas-host/tests/host_test.rs @@ -2442,18 +2442,30 @@ fn incomplete_consumable_definitions_are_dropped_not_drawn_wrong() { ); } +/// One catalogued card for [`club_resolver`]: the FIFA facts the production +/// classification path reads. +struct CatalogCard { + card_id: &'static str, + asset_id: u32, + kind: &'static str, + subtype: i64, + card_asset_id: u32, + team_id: Option, +} + /// A resolver over a catalog that states each card's KIND, so club families flow /// through exactly the production classification path (catalog kind -> shaper), /// not a test-only stub. -fn club_resolver( - cards: &[(&str, u32, &str, i64, u32, Option)], -) -> Arc { +fn club_resolver(cards: &[CatalogCard]) -> Arc { let entries: Vec = cards .iter() - .map(|(id, asset, kind, subtype, art, team)| { - let team = team + .map(|c| { + let team = c + .team_id .map(|t| format!(",\"team_id\":{t}")) .unwrap_or_default(); + let (id, asset, kind) = (c.card_id, c.asset_id, c.kind); + let (subtype, art) = (c.subtype, c.card_asset_id); format!( "\"{id}\":{{\"asset_id\":{asset},\"kind\":\"{kind}\",\"subtype\":{subtype},\ \"card_asset_id\":{art}{team}}}" @@ -2478,19 +2490,28 @@ fn club_resolver( /// here: an empty result must not be an accident of a missing asset id. #[test] fn every_ownable_class_projects_on_its_own_arm() { - let cards: Vec<(&str, u32, &str, i64, u32, Option)> = vec![ - ("c_player", 20801, "player", 0, 0, None), - ("c_manager", 1_000_509, "manager", 4, 0, None), - ("c_coach", 3_000_083, "staff", 8, 0, None), - ("c_kit", 6_300_006, "kit", 9, 35, Some(21)), - ("c_badge", 6_000_005, "badge", 11, 39, Some(21)), - ("c_stadium", 6_200_000, "stadium", 10, 36, None), - ("c_ball", 8_120_194, "ball", 30, 37, None), - ("c_logo", 8_010_015, "misc", 31, 40, None), + let card = |card_id, asset_id, kind, subtype, card_asset_id, team_id| CatalogCard { + card_id, + asset_id, + kind, + subtype, + card_asset_id, + team_id, + }; + let cards = vec![ + card("c_player", 20801, "player", 0, 0, None), + card("c_manager", 1_000_509, "manager", 4, 0, None), + card("c_coach", 3_000_083, "staff", 8, 0, None), + card("c_kit", 6_300_006, "kit", 9, 35, Some(21)), + card("c_badge", 6_000_005, "badge", 11, 39, Some(21)), + card("c_stadium", 6_200_000, "stadium", 10, 36, None), + card("c_ball", 8_120_194, "ball", 30, 37, None), + card("c_logo", 8_010_015, "misc", 31, 40, None), ]; let owned: Vec = cards .iter() - .map(|(id, ..)| { + .map(|c| { + let id = c.card_id; item( &format!("oc_{id}"), id,