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.
This commit is contained in:
funman300
2026-08-21 21:00:25 +00:00
parent 622a6ab353
commit 7f17cfe439
+36 -15
View File
@@ -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<i64>,
}
/// 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<i64>)],
) -> Arc<Fifa17IdentityResolver> {
fn club_resolver(cards: &[CatalogCard]) -> Arc<Fifa17IdentityResolver> {
let entries: Vec<String> = 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<i64>)> = 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<CoreOwnedItem> = cards
.iter()
.map(|(id, ..)| {
.map(|c| {
let id = c.card_id;
item(
&format!("oc_{id}"),
id,