Prepare the held grid on arrival and keep the followed game apart from older Matches (#89)
CI / core (pull_request) Successful in 1m33s
CI / core (push) Successful in 1m36s

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit was merged in pull request #99.
This commit is contained in:
nessarandClaude Opus 5.5 committed 2026-11-22 16:06:03 +01:00
1 parent 44c2d10b3b
commit ee2ab5cc33
9 files changed
+572 -182

No files matched your search

+45 -3
View File
@@ -32,8 +32,9 @@ fn other_account() -> Account {
}
/// One Arena 3x6 Match of the recorded Account, placed first with Jinx.
fn new_match(id: &str, hours: i64) -> String {
payload(id, 1750, 222, "Jinx", 1, true, at(date(2026, 4, 5), hours))
/// A Match started `minutes` after the rounds' clock starts (`now()`): a game the client follows.
fn new_match(id: &str, minutes: i64) -> String {
payload(id, 1750, 222, "Jinx", 1, true, now() + minutes * 60_000)
}
struct World {
@@ -738,7 +739,7 @@ fn a_game_the_client_gave_no_id_for_is_reported_when_a_sync_stores_it() {
"Jinx",
6,
false,
at(date(2026, 4, 5), 1),
now() + 60_000,
));
world.client.set_phase("EndOfGame", true);
@@ -754,6 +755,47 @@ fn a_game_the_client_gave_no_id_for_is_reported_when_a_sync_stores_it() {
assert!(reported_round(&tracker).is_empty());
}
#[test]
fn an_older_match_a_sync_brings_is_history_and_the_game_without_an_id_still_waits() {
let world = World::new(&s2_matches());
let tracker = world.tracker();
assert!(reported_round(&tracker).is_empty(), "history import");
world.client.set_game_id(None);
world.client.set_phase("InProgress", true);
assert!(reported_round(&tracker).is_empty());
// A game played before this one, newer than every Match stored, that Riot lists only now.
world.history.add(payload(
"EUW1_earlier",
1750,
11,
"Ahri",
2,
true,
now() - 30 * 60_000,
));
world.client.set_phase("EndOfGame", true);
assert!(reported_round(&tracker).is_empty());
assert_eq!(tracker.match_count(SELF_PUUID).unwrap(), 3);
// The followed game's Match, published later, is the one reported.
world.history.add(new_match("EUW1_followed", 1));
let events = reported_round(&tracker);
assert_eq!(tracker.match_count(SELF_PUUID).unwrap(), 4);
assert_eq!(
events
.iter()
.map(|e| (e.champion_id, e.end))
.collect::<Vec<_>>(),
[(222, MatchEnd::Completed)]
);
assert_eq!(tracker.status().problem, None);
let calls = world.source_calls();
assert!(reported_round(&tracker).is_empty());
assert_eq!(world.source_calls(), calls, "the wait is over");
}
#[test]
fn without_a_platform_the_first_import_reports_only_the_game_the_client_named() {
let world = World::new(&[]);