mirror of
https://codeberg.org/demostf/api-test.git
synced 2026-06-03 09:34:10 +02:00
add test for reconnected
This commit is contained in:
parent
8d644494d5
commit
a5cf0ab09f
7 changed files with 28 additions and 9 deletions
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
*.dem filter=lfs diff=lfs merge=lfs -text
|
||||||
Binary file not shown.
BIN
data/granary.dem
BIN
data/granary.dem
Binary file not shown.
BIN
data/process.dem
BIN
data/process.dem
Binary file not shown.
BIN
data/ultiduo.dem
BIN
data/ultiduo.dem
Binary file not shown.
Binary file not shown.
36
src/main.rs
36
src/main.rs
|
|
@ -24,7 +24,7 @@ async fn main() -> Result<()> {
|
||||||
let granary_data = include_bytes!("../data/granary.dem");
|
let granary_data = include_bytes!("../data/granary.dem");
|
||||||
let process_data = include_bytes!("../data/process.dem");
|
let process_data = include_bytes!("../data/process.dem");
|
||||||
let warmfrost_data = include_bytes!("../data/warmfrost.dem");
|
let warmfrost_data = include_bytes!("../data/warmfrost.dem");
|
||||||
let coalplant_data = include_bytes!("../data/coalplant.dem");
|
let reconnect_data = include_bytes!("../data/reconnect.dem");
|
||||||
let ultiduo_data = include_bytes!("../data/ultiduo.dem");
|
let ultiduo_data = include_bytes!("../data/ultiduo.dem");
|
||||||
|
|
||||||
let edit_key = dotenv::var("EDIT_KEY")?;
|
let edit_key = dotenv::var("EDIT_KEY")?;
|
||||||
|
|
@ -212,7 +212,7 @@ async fn main() -> Result<()> {
|
||||||
client
|
client
|
||||||
.upload_demo(
|
.upload_demo(
|
||||||
String::from("test4.dem"),
|
String::from("test4.dem"),
|
||||||
coalplant_data.to_vec(),
|
reconnect_data.to_vec(),
|
||||||
String::from("RED"),
|
String::from("RED"),
|
||||||
String::from("BLUE"),
|
String::from("BLUE"),
|
||||||
String::from("token"),
|
String::from("token"),
|
||||||
|
|
@ -274,9 +274,10 @@ async fn main() -> Result<()> {
|
||||||
1,
|
1,
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
assert_eq(list.len(), 2)?;
|
assert_eq(list.len(), 3)?;
|
||||||
assert_eq(list[0].id, 5)?;
|
assert_eq(list[0].id, 5)?;
|
||||||
assert_eq(list[1].id, 1)?;
|
assert_eq(list[1].id, 4)?;
|
||||||
|
assert_eq(list[2].id, 1)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
})
|
})
|
||||||
.await?;
|
.await?;
|
||||||
|
|
@ -288,8 +289,26 @@ async fn main() -> Result<()> {
|
||||||
1,
|
1,
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
assert_eq(list.len(), 2)?;
|
||||||
|
assert_eq(list[0].id, 4)?;
|
||||||
|
assert_eq(list[1].id, 1)?;
|
||||||
|
Ok(())
|
||||||
|
})
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
test.step("list reconnected player filter", |client| async move {
|
||||||
|
let list = client
|
||||||
|
.list(
|
||||||
|
ListParams::default().with_players(vec![
|
||||||
|
76561198024494988,
|
||||||
|
76561198011495003,
|
||||||
|
76561197998883586, // <- reconnected
|
||||||
|
]),
|
||||||
|
1,
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
assert_eq(list.len(), 1)?;
|
assert_eq(list.len(), 1)?;
|
||||||
assert_eq(list[0].id, 1)?;
|
assert_eq(list[0].id, 4)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
})
|
})
|
||||||
.await?;
|
.await?;
|
||||||
|
|
@ -326,10 +345,9 @@ async fn main() -> Result<()> {
|
||||||
let list = client
|
let list = client
|
||||||
.list(ListParams::default().with_type(GameType::Fours), 1)
|
.list(ListParams::default().with_type(GameType::Fours), 1)
|
||||||
.await?;
|
.await?;
|
||||||
assert_eq(list.len(), 2)?;
|
assert_eq(list.len(), 1)?;
|
||||||
assert_eq(list[0].id, 4)?;
|
assert_eq(list[0].id, 3)?;
|
||||||
assert_eq(list[1].id, 3)?;
|
Ok(list[0].time)
|
||||||
Ok(list[1].time)
|
|
||||||
})
|
})
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue