You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
548 B
Rust
20 lines
548 B
Rust
use crate::url::*;
|
|
|
|
#[test]
|
|
fn it_returns_the_domain_name() {
|
|
assert_eq!(
|
|
get_domain_for_url("https://domain.com/sub/sub"),
|
|
Some("domain.com".to_string())
|
|
);
|
|
assert_eq!(
|
|
get_domain_for_url("other-domain.com"),
|
|
Some("other-domain.com".to_string())
|
|
);
|
|
assert_eq!(get_domain_for_url("Invalid URL"), None);
|
|
assert_eq!(get_domain_for_url("file:////what/a/file.txt"), None);
|
|
assert_eq!(
|
|
get_domain_for_url("https://www.domain.com/sub",),
|
|
Some("domain.com".to_string())
|
|
);
|
|
}
|