Skip to content

Commit

Permalink
add integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter John committed Sep 25, 2022
1 parent aeeb835 commit 4650209
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 0 deletions.
60 changes: 60 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ tide = "0.16.0"
pretty_assertions = "0.6"
async-std = { version = "1.9.0", features = ["attributes"] }
trybuild = "1.0"
tide-testing = "0.1.3"
27 changes: 27 additions & 0 deletions tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,3 +251,30 @@ mod other {
}
}
}

mod integration {
use crate::view;
use tide_testing::TideTestingExt;

#[async_std::test]
async fn test_server() -> tide::Result<()> {
let mut app = tide::new();
app.at("/").get(|_| async {
view! {
<div>
<p>{"Hello World"}</p>
</div>
}
});

assert_eq!(
app.get("/").recv_string().await?,
"<div><p>Hello World</p></div>"
);
assert_eq!(
app.post("/missing").await?.status(),
tide::http::StatusCode::NotFound
);
Ok(())
}
}

0 comments on commit 4650209

Please sign in to comment.