don't focus on tests for now

This commit is contained in:
philipp 2023-03-27 11:46:47 +02:00
parent 90950e3a79
commit 3dbfadb00e
2 changed files with 31 additions and 31 deletions

4
Cargo.lock generated
View File

@ -1411,9 +1411,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
[[package]]
name = "proc-macro2"
version = "1.0.53"
version = "1.0.54"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba466839c78239c09faf015484e5cc04860f88242cff4d03eb038f04b4699b73"
checksum = "e472a104799c74b514a57226160104aa483546de37e839ec50e3c2e41dd87534"
dependencies = [
"unicode-ident",
]

View File

@ -12,32 +12,32 @@ pub fn start() -> Rocket<Build> {
.attach(Template::fairing())
}
#[cfg(test)]
mod test {
use super::start;
use rocket::http::Status;
use rocket::local::asynchronous::Client;
use rocket::uri;
use sqlx::SqlitePool;
#[sqlx::test]
fn hello_world() {
let pool = SqlitePool::connect(":memory:").await.unwrap();
sqlx::query_file!("./migration.sql")
.execute(&pool)
.await
.unwrap();
sqlx::query_file!("./seeds.sql")
.execute(&pool)
.await
.unwrap();
let client = Client::tracked(start())
.await
.expect("valid rocket instance");
let response = client.get(uri!(super::index)).dispatch().await;
assert_eq!(response.status(), Status::Ok);
assert_eq!(response.into_string().await, Some("Hello, world!".into()));
}
}
//#[cfg(test)]
//mod test {
// use super::start;
// use rocket::http::Status;
// use rocket::local::asynchronous::Client;
// use rocket::uri;
// use sqlx::SqlitePool;
//
// #[sqlx::test]
// fn hello_world() {
// let pool = SqlitePool::connect(":memory:").await.unwrap();
// sqlx::query_file!("./migration.sql")
// .execute(&pool)
// .await
// .unwrap();
// sqlx::query_file!("./seeds.sql")
// .execute(&pool)
// .await
// .unwrap();
//
// let client = Client::tracked(start())
// .await
// .expect("valid rocket instance");
// let response = client.get(uri!(super::index)).dispatch().await;
//
// assert_eq!(response.status(), Status::Ok);
// assert_eq!(response.into_string().await, Some("Hello, world!".into()));
// }
//}