45 lines
2.3 KiB
Rust
45 lines
2.3 KiB
Rust
|
use crate::utils;
|
||
|
|
||
|
// ██████╗ █████╗ ███████╗███████╗██╗███╗ ██╗ ██████╗
|
||
|
// ██╔══██╗██╔══██╗██╔════╝██╔════╝██║████╗ ██║██╔════╝
|
||
|
// ██████╔╝███████║███████╗███████╗██║██╔██╗ ██║██║ ███╗
|
||
|
// ██╔═══╝ ██╔══██║╚════██║╚════██║██║██║╚██╗██║██║ ██║
|
||
|
// ██║ ██║ ██║███████║███████║██║██║ ╚████║╚██████╔╝
|
||
|
// ╚═╝ ╚═╝ ╚═╝╚══════╝╚══════╝╚═╝╚═╝ ╚═══╝ ╚═════╝
|
||
|
|
||
|
#[test]
|
||
|
fn passing_data_url_text_html() {
|
||
|
assert!(utils::is_data_url(
|
||
|
"data:text/html;base64,V2VsY29tZSBUbyBUaGUgUGFydHksIDxiPlBhbDwvYj4h"
|
||
|
));
|
||
|
}
|
||
|
|
||
|
#[test]
|
||
|
fn passing_data_url_no_media_type() {
|
||
|
assert!(utils::is_data_url(
|
||
|
"data:;base64,V2VsY29tZSBUbyBUaGUgUGFydHksIDxiPlBhbDwvYj4h"
|
||
|
));
|
||
|
}
|
||
|
|
||
|
// ███████╗ █████╗ ██╗██╗ ██╗███╗ ██╗ ██████╗
|
||
|
// ██╔════╝██╔══██╗██║██║ ██║████╗ ██║██╔════╝
|
||
|
// █████╗ ███████║██║██║ ██║██╔██╗ ██║██║ ███╗
|
||
|
// ██╔══╝ ██╔══██║██║██║ ██║██║╚██╗██║██║ ██║
|
||
|
// ██║ ██║ ██║██║███████╗██║██║ ╚████║╚██████╔╝
|
||
|
// ╚═╝ ╚═╝ ╚═╝╚═╝╚══════╝╚═╝╚═╝ ╚═══╝ ╚═════╝
|
||
|
|
||
|
#[test]
|
||
|
fn failing_https_url() {
|
||
|
assert!(!utils::is_data_url("https://kernel.org"));
|
||
|
}
|
||
|
|
||
|
#[test]
|
||
|
fn failing_no_protocol_url() {
|
||
|
assert!(!utils::is_data_url("//kernel.org"));
|
||
|
}
|
||
|
|
||
|
#[test]
|
||
|
fn failing_empty_string() {
|
||
|
assert!(!utils::is_data_url(""));
|
||
|
}
|