aboutsummaryrefslogtreecommitdiffstats
path: root/tests/navigation.rs
diff options
context:
space:
mode:
authorSven-Hendrik Haase <svenstaro@gmail.com>2024-01-13 05:11:59 +0000
committerSven-Hendrik Haase <svenstaro@gmail.com>2024-01-13 05:11:59 +0000
commit562b62a0b638d2ca0731f83476a2e5f74757962a (patch)
tree2073b8249218f86e95d57b7734310495cb7db109 /tests/navigation.rs
parentFix formatting (diff)
downloadminiserve-562b62a0b638d2ca0731f83476a2e5f74757962a.tar.gz
miniserve-562b62a0b638d2ca0731f83476a2e5f74757962a.zip
Clean up default order function
I removed the stringly typing as we already have enums for this that we can make use of.
Diffstat (limited to 'tests/navigation.rs')
-rw-r--r--tests/navigation.rs16
1 files changed, 6 insertions, 10 deletions
diff --git a/tests/navigation.rs b/tests/navigation.rs
index b921d4c..734424a 100644
--- a/tests/navigation.rs
+++ b/tests/navigation.rs
@@ -7,7 +7,7 @@ use rstest::rstest;
use select::document::Document;
use std::process::{Command, Stdio};
use utils::get_link_from_text;
-use utils::get_link_hrefs_from_text_with_prefix;
+use utils::get_link_hrefs_with_prefix;
#[rstest(
input,
@@ -154,22 +154,18 @@ fn can_navigate_using_breadcrumbs(
#[case(server(&["--default-sorting-method", "date", "--default-sorting-order", "asc"]))]
/// We can specify the default sorting order
fn can_specify_default_sorting_order(#[case] server: TestServer) -> Result<(), Error> {
- let slash = String::from("/");
- let base_url = server.url();
- let nested_url = base_url.join(&slash)?;
-
- let resp = reqwest::blocking::get(nested_url.as_str())?;
+ let resp = reqwest::blocking::get(server.url())?;
let body = resp.error_for_status()?;
let parsed = Document::from_read(body)?;
- let links = get_link_hrefs_from_text_with_prefix(&parsed, "/");
- let first_created_file = slash + FILES.first().unwrap();
+ let links = get_link_hrefs_with_prefix(&parsed, "/");
+ let first_created_file = FILES.first().unwrap();
- if links.first().unwrap() == &first_created_file {
+ if links.first().unwrap() == first_created_file {
assert_eq!("/very/?sort=date&order=asc", links.last().unwrap());
}
- if links.last().unwrap() == &first_created_file {
+ if links.last().unwrap() == first_created_file {
assert_eq!("/very/?sort=date&order=desc", links.first().unwrap());
}