test: add tests for URL extraction ending with a period (#1641)

This commit is contained in:
Matthias Endler 2025-02-24 08:48:58 +01:00 committed by GitHub
parent b1cb2564a2
commit d33b7554a1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 26 additions and 0 deletions

1
fixtures/LINK_PERIOD.html vendored Normal file
View file

@ -0,0 +1 @@
<a href="https://www.example.com/smth.">link</a>

View file

@ -1990,4 +1990,29 @@ mod cli {
Ok(())
}
#[test]
fn test_extract_url_ending_with_period_file() {
let test_path = fixtures_path().join("LINK_PERIOD.html");
let mut cmd = main_command();
cmd.arg("--dump")
.arg(test_path)
.assert()
.success()
.stdout(contains("https://www.example.com/smth."));
}
#[tokio::test]
async fn test_extract_url_ending_with_period_webserver() {
let mut cmd = main_command();
let body = r#"<a href="https://www.example.com/smth.">link</a>"#;
let mock_server = mock_response!(body);
cmd.arg("--dump")
.arg(mock_server.uri())
.assert()
.success()
.stdout(contains("https://www.example.com/smth."));
}
}