mirror of https://github.com/Y2Z/monolith
add option to exclude specific domains
parent
9a782d5e9c
commit
e89b79492b
@ -0,0 +1,86 @@
|
||||
// ██████╗ █████╗ ███████╗███████╗██╗███╗ ██╗ ██████╗
|
||||
// ██╔══██╗██╔══██╗██╔════╝██╔════╝██║████╗ ██║██╔════╝
|
||||
// ██████╔╝███████║███████╗███████╗██║██╔██╗ ██║██║ ███╗
|
||||
// ██╔═══╝ ██╔══██║╚════██║╚════██║██║██║╚██╗██║██║ ██║
|
||||
// ██║ ██║ ██║███████║███████║██║██║ ╚████║╚██████╔╝
|
||||
// ╚═╝ ╚═╝ ╚═╝╚══════╝╚══════╝╚═╝╚═╝ ╚═══╝ ╚═════╝
|
||||
|
||||
#[cfg(test)]
|
||||
mod passing {
|
||||
use monolith::utils;
|
||||
|
||||
#[test]
|
||||
fn sub_domain_is_within_domain() {
|
||||
assert!(utils::domain_is_within_domain(
|
||||
"news.ycombinator.com",
|
||||
"ycombinator.com"
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sub_domain_is_within_dotted_domain() {
|
||||
assert!(utils::domain_is_within_domain(
|
||||
"news.ycombinator.com",
|
||||
".ycombinator.com"
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn domain_is_within_top_level_domain() {
|
||||
assert!(utils::domain_is_within_domain("ycombinator.com", "com"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn domain_is_within_itself() {
|
||||
assert!(utils::domain_is_within_domain(
|
||||
"ycombinator.com",
|
||||
"ycombinator.com"
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sub_domain_is_within_dotted_itself() {
|
||||
assert!(utils::domain_is_within_domain(
|
||||
"ycombinator.com",
|
||||
".ycombinator.com"
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
// ███████╗ █████╗ ██╗██╗ ██╗███╗ ██╗ ██████╗
|
||||
// ██╔════╝██╔══██╗██║██║ ██║████╗ ██║██╔════╝
|
||||
// █████╗ ███████║██║██║ ██║██╔██╗ ██║██║ ███╗
|
||||
// ██╔══╝ ██╔══██║██║██║ ██║██║╚██╗██║██║ ██║
|
||||
// ██║ ██║ ██║██║███████╗██║██║ ╚████║╚██████╔╝
|
||||
// ╚═╝ ╚═╝ ╚═╝╚═╝╚══════╝╚═╝╚═╝ ╚═══╝ ╚═════╝
|
||||
|
||||
#[cfg(test)]
|
||||
mod failing {
|
||||
use monolith::utils;
|
||||
|
||||
#[test]
|
||||
fn sub_domain_is_not_within_domain() {
|
||||
assert!(!utils::domain_is_within_domain(
|
||||
"news.ycombinator.com",
|
||||
"kernel.org"
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn sub_domain_is_not_within_top_level_domain() {
|
||||
assert!(!utils::domain_is_within_domain(
|
||||
"news.ycombinator.com",
|
||||
"org"
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn no_domain_is_not_within_dot() {
|
||||
assert!(!utils::domain_is_within_domain("news.ycombinator.com", "."));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn no_domain_is_within_empty_domain() {
|
||||
assert!(!utils::domain_is_within_domain("news.ycombinator.com", ""));
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
mod detect_media_type;
|
||||
mod domain_is_within_domain;
|
||||
mod indent;
|
||||
mod parse_content_type;
|
||||
mod retrieve_asset;
|
||||
|
Loading…
Reference in New Issue