2023-11-14 10:01:31 -08:00
|
|
|
// TODO: fold this into loader_fields.rs or tags.rs of other v3 testing PR
|
|
|
|
|
|
2023-11-25 13:42:39 -08:00
|
|
|
use common::{
|
|
|
|
|
api_v3::ApiV3,
|
2025-05-09 07:27:55 -05:00
|
|
|
environment::{TestEnvironment, with_test_environment},
|
2023-11-25 13:42:39 -08:00
|
|
|
};
|
2023-11-14 10:01:31 -08:00
|
|
|
|
2025-06-14 02:10:12 +02:00
|
|
|
pub mod common;
|
2023-11-14 10:01:31 -08:00
|
|
|
|
|
|
|
|
#[actix_rt::test]
|
|
|
|
|
async fn get_games() {
|
2024-10-18 16:07:35 -07:00
|
|
|
with_test_environment(
|
|
|
|
|
None,
|
|
|
|
|
|test_env: TestEnvironment<ApiV3>| async move {
|
|
|
|
|
let api = test_env.api;
|
2023-11-14 10:01:31 -08:00
|
|
|
|
2024-10-18 16:07:35 -07:00
|
|
|
let games = api.get_games_deserialized().await;
|
2023-11-14 10:01:31 -08:00
|
|
|
|
2024-10-18 16:07:35 -07:00
|
|
|
// There should be 2 games in the dummy data
|
|
|
|
|
assert_eq!(games.len(), 2);
|
|
|
|
|
assert_eq!(games[0].name, "minecraft-java");
|
|
|
|
|
assert_eq!(games[1].name, "minecraft-bedrock");
|
2023-11-14 10:01:31 -08:00
|
|
|
|
2024-10-18 16:07:35 -07:00
|
|
|
assert_eq!(games[0].slug, "minecraft-java");
|
|
|
|
|
assert_eq!(games[1].slug, "minecraft-bedrock");
|
|
|
|
|
},
|
|
|
|
|
)
|
2023-11-25 13:42:39 -08:00
|
|
|
.await;
|
2023-11-14 10:01:31 -08:00
|
|
|
}
|