feat(delta): test harness for web server
This commit is contained in:
@@ -1 +1,2 @@
|
||||
pub mod ratelimiter;
|
||||
pub mod test;
|
||||
|
||||
26
crates/delta/src/util/test.rs
Normal file
26
crates/delta/src/util/test.rs
Normal file
@@ -0,0 +1,26 @@
|
||||
use rocket::local::asynchronous::Client;
|
||||
use std::ops::Deref;
|
||||
|
||||
pub struct TestHarness {
|
||||
client: Client,
|
||||
}
|
||||
|
||||
impl TestHarness {
|
||||
pub async fn new() -> TestHarness {
|
||||
dotenv::dotenv().ok();
|
||||
|
||||
let client = Client::tracked(crate::web().await)
|
||||
.await
|
||||
.expect("valid rocket instance");
|
||||
|
||||
TestHarness { client }
|
||||
}
|
||||
}
|
||||
|
||||
impl Deref for TestHarness {
|
||||
type Target = Client;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.client
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user