use fulltime_plugin_api::{
Competition, Fixture, FixtureStatus, Score, Standings, StandingsGroup, StandingsRow, Team,
};
fn team(id: &str, name: &str, short_name: &str) -> Team {
Team {
id: id.to_owned(),
name: name.to_owned(),
short_name: short_name.to_owned(),
}
}
#[test]
fn league_fixture_matches_openligadb_match_shape() {
let fixture = Fixture {
id: "6197".to_owned(),
competition_id: "bl1-2024".to_owned(),
group: None, kickoff: "2024-08-23T18:30:00Z".to_owned(),
home_team: team("40", "FC Bayern München", "FCB"),
away_team: team("81", "TSG 1899 Hoffenheim", "TSG"),
venue: None,
status: FixtureStatus::Finished,
score: Some(Score { home: 2, away: 0 }),
};
assert_eq!(fixture.status, FixtureStatus::Finished);
assert_eq!(fixture.score, Some(Score { home: 2, away: 0 }));
}
#[test]
fn league_table_matches_openligadb_table_team_shape() {
let row = StandingsRow {
team: team("40", "FC Bayern München", "FCB"),
rank: 1,
played: 3,
won: 3,
drawn: 0,
lost: 0,
goals_for: 12,
goals_against: 2,
points: 9,
};
let standings = Standings {
competition_id: "bl1-2024".to_owned(),
groups: vec![StandingsGroup {
name: None, rows: vec![row],
}],
};
assert_eq!(standings.groups.len(), 1);
assert_eq!(standings.groups[0].rows[0].points, 9);
}
#[test]
fn competition_metadata_fits_canonical_shape() {
let competition = Competition {
id: "bl1-2024".to_owned(),
name: "Bundesliga 2024/25".to_owned(),
};
assert_eq!(competition.id, "bl1-2024");
}