mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-08 12:19:24 +00:00
Use dockertest for the newly added serai-client-serai test
This commit is contained in:
@@ -30,3 +30,6 @@ async-lock = "3"
|
||||
|
||||
[dev-dependencies]
|
||||
tokio = { version = "1", default-features = false, features = ["rt", "macros"] }
|
||||
dockertest = "0.5"
|
||||
serai-docker-tests = { path = "../../../tests/docker" }
|
||||
serai-substrate-tests = { path = "../../../tests/substrate" }
|
||||
|
||||
@@ -1,9 +1,19 @@
|
||||
use serai_client_serai::*;
|
||||
|
||||
#[tokio::test]
|
||||
async fn main() {
|
||||
let serai = Serai::new("http://127.0.0.1:9944".to_string()).unwrap();
|
||||
let block = serai.block_by_number(0).await.unwrap();
|
||||
assert_eq!(serai.block(block.header.hash()).await.unwrap(), block);
|
||||
assert!(serai.finalized(block.header.hash()).await.unwrap());
|
||||
async fn blockchain() {
|
||||
let mut test = dockertest::DockerTest::new();
|
||||
let (composition, handle) = serai_substrate_tests::composition(
|
||||
"alice",
|
||||
serai_docker_tests::fresh_logs_folder(true, "serai-client/blockchain"),
|
||||
);
|
||||
test.provide_container(composition);
|
||||
test
|
||||
.run_async(async |ops| {
|
||||
let serai = serai_substrate_tests::rpc(&ops, handle).await;
|
||||
let block = serai.block_by_number(0).await.unwrap();
|
||||
assert_eq!(serai.block(block.header.hash()).await.unwrap(), block);
|
||||
assert!(serai.finalized(block.header.hash()).await.unwrap());
|
||||
})
|
||||
.await;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user