Skip to content

Commit

Permalink
Adds (failing) test for subrouters
Browse files Browse the repository at this point in the history
  • Loading branch information
sorcix committed Oct 21, 2021
1 parent 1d6f120 commit 3a285bb
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/nested.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,17 @@ async fn nested_with_different_state() -> tide::Result<()> {
assert_eq!(outer.get("/").recv_string().await?, "Hello, world!");
Ok(())
}

#[async_std::test]
async fn nested_with_slash_path() -> tide::Result<()> {
let mut outer = tide::new();
let mut inner = tide::new();
inner.at("/").get(|_| async { Ok("nested") });
outer.at("/").get(|_| async { Ok("root") });
outer.at("/foo").nest(inner);

assert_eq!(outer.get("/foo").recv_string().await?, "nested");
assert_eq!(outer.get("/foo/").recv_string().await?, "nested");
assert_eq!(outer.get("/").recv_string().await?, "root");
Ok(())
}

0 comments on commit 3a285bb

Please sign in to comment.