style(core): cargo fmt match/club agent additions
CI / Build, lint & test (push) Successful in 4m1s

This commit is contained in:
funman300
2026-08-20 17:59:02 +00:00
parent 5f9f556af8
commit 2fb835200f
4 changed files with 108 additions and 83 deletions
+38 -10
View File
@@ -438,7 +438,9 @@ async fn complete_match_inner(
));
}
if req.match_identity.trim().is_empty() {
return Err(AppError::BadRequest("match_identity must not be empty".into()));
return Err(AppError::BadRequest(
"match_identity must not be empty".into(),
));
}
let result = req.result;
@@ -905,7 +907,11 @@ mod match_completion_tests {
assert_eq!(r.xp_awarded, XP_LOSS);
assert_eq!(r.match_record.outcome, "dnf");
assert_eq!(stat(&fx.pool, "matches_dnf").await, 1);
assert_eq!(stat(&fx.pool, "matches_lost").await, 0, "DNF is not a loss row");
assert_eq!(
stat(&fx.pool, "matches_lost").await,
0,
"DNF is not a loss row"
);
assert_eq!(stat(&fx.pool, "matches_played").await, 1);
assert_eq!(coins(&fx.pool).await, START_COINS + COINS_LOSS);
}
@@ -922,7 +928,11 @@ mod match_completion_tests {
assert_eq!(r.match_record.outcome, "no_contest");
assert_eq!(coins(&fx.pool).await, START_COINS, "no coins for a void");
assert_eq!(xp(&fx.pool).await, 0);
assert_eq!(stat(&fx.pool, "matches_played").await, 0, "not counted as played");
assert_eq!(
stat(&fx.pool, "matches_played").await,
0,
"not counted as played"
);
// Still recorded for history + idempotency.
assert_eq!(count(&fx.pool, "matches").await, 1);
assert_eq!(count(&fx.pool, "match_completions").await, 1);
@@ -1089,7 +1099,11 @@ mod match_completion_tests {
.await
.unwrap();
assert!(retry.applied, "{fp:?} retry-after-fault must apply");
assert_eq!(coins(&fx.pool).await, START_COINS + COINS_WIN, "{fp:?} retry");
assert_eq!(
coins(&fx.pool).await,
START_COINS + COINS_WIN,
"{fp:?} retry"
);
}
}
@@ -1129,9 +1143,16 @@ mod match_completion_tests {
];
let achs = vec![ach("first_win", "matches_won", 1, 50)];
let first = complete_match(&fx.pool, PROFILE, CLUB, &req("m", MatchResultKind::Win, 2, 0), &objs, &achs)
.await
.unwrap();
let first = complete_match(
&fx.pool,
PROFILE,
CLUB,
&req("m", MatchResultKind::Win, 2, 0),
&objs,
&achs,
)
.await
.unwrap();
assert!(first.applied);
assert_eq!(first.objectives_updated.len(), 2);
assert_eq!(first.achievements_unlocked.len(), 1);
@@ -1140,9 +1161,16 @@ mod match_completion_tests {
assert_eq!(count(&fx.pool, "player_achievements").await, 1);
// Replay: no double objectives/achievements/coins.
let replay = complete_match(&fx.pool, PROFILE, CLUB, &req("m", MatchResultKind::Win, 2, 0), &objs, &achs)
.await
.unwrap();
let replay = complete_match(
&fx.pool,
PROFILE,
CLUB,
&req("m", MatchResultKind::Win, 2, 0),
&objs,
&achs,
)
.await
.unwrap();
assert!(!replay.applied);
assert!(replay.objectives_updated.is_empty());
assert!(replay.achievements_unlocked.is_empty());