Tests v2 recreate (#760)

* added common project information; setup for v2 test change

* all tests now use with_test_environment

* progress, failing

* finished re-adding tests

* prepare

* cargo sqlx prepare -- --tests

* fmt; clippy; prepare

* sqlx prepare

* adds version_create fix and corresponding test

* merge fixes; rev

* fmt, clippy, prepare

* test cargo sqlx prepare
This commit is contained in:
Wyatt Verchere
2023-11-25 13:42:39 -08:00
committed by GitHub
parent ade8c162cd
commit 172b93d07f
51 changed files with 7573 additions and 6631 deletions

View File

@@ -1,23 +1,26 @@
// TODO: fold this into loader_fields.rs or tags.rs of other v3 testing PR
use crate::common::environment::TestEnvironment;
use common::{
api_v3::ApiV3,
environment::{with_test_environment, TestEnvironment},
};
mod common;
#[actix_rt::test]
async fn get_games() {
let test_env = TestEnvironment::build(None).await;
let api = &test_env.v3;
with_test_environment(None, |test_env: TestEnvironment<ApiV3>| async move {
let api = test_env.api;
let games = api.get_games_deserialized().await;
let games = api.get_games_deserialized().await;
// 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");
// 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");
assert_eq!(games[0].slug, "minecraft-java");
assert_eq!(games[1].slug, "minecraft-bedrock");
test_env.cleanup().await;
assert_eq!(games[0].slug, "minecraft-java");
assert_eq!(games[1].slug, "minecraft-bedrock");
})
.await;
}