add transactions

This commit is contained in:
Robin Appelman 2023-11-19 15:04:09 +01:00
commit bd2cd8afe6
9 changed files with 2907 additions and 32 deletions

File diff suppressed because it is too large Load diff

View file

@ -2,7 +2,7 @@ use insta::assert_json_snapshot;
use std::fs::read_to_string;
use ugc_scraper::parser::{
MatchPageParser, Parser, PlayerDetailsParser, PlayerParser, SeasonsParser, TeamLookupParser,
TeamMatchesParser, TeamParser, TeamRosterHistoryParser,
TeamMatchesParser, TeamParser, TeamRosterHistoryParser, TransactionParser,
};
#[test]
@ -100,3 +100,11 @@ fn test_parse_match_html() {
let parsed = parser.parse(&body).unwrap();
assert_json_snapshot!(parsed);
}
#[test]
fn test_parse_transaction_html() {
let body = read_to_string("tests/data/transactions_4v4.html").unwrap();
let parser = TransactionParser::new();
let parsed = parser.parse(&body).unwrap();
assert_json_snapshot!(parsed);
}

View file

@ -0,0 +1,69 @@
---
source: tests/snapshot.rs
expression: parsed
---
[
{
"name": "L9 ivan",
"steam_id": 76561199017754044,
"action": "Joined",
"team": {
"name": "1. e4 e5 2. Ke2 Ke7",
"id": 33233
}
},
{
"name": "Rhythm",
"steam_id": 76561198062801366,
"action": "Joined",
"team": {
"name": "#FreeTheBlackHeavy",
"id": 33011
}
},
{
"name": "G Punish",
"steam_id": 76561198207987376,
"action": "Left",
"team": {
"name": "1. e4 e5 2. Ke2 Ke7",
"id": 33233
}
},
{
"name": "hellboy",
"steam_id": 76561199089196165,
"action": "Joined",
"team": {
"name": "1. e4 e5 2. Ke2 Ke7",
"id": 33233
}
},
{
"name": "realhedgehog2082",
"steam_id": 76561198168931330,
"action": "Left",
"team": {
"name": "1. e4 e5 2. Ke2 Ke7",
"id": 33233
}
},
{
"name": "Rhythm",
"steam_id": 76561198062801366,
"action": "Left",
"team": {
"name": "el gato",
"id": 33014
}
},
{
"name": "Pope Sonder",
"steam_id": 76561198214202059,
"action": "Left",
"team": {
"name": "Gaelic Gladiators",
"id": 29916
}
}
]