#[allow(dead_code)]
pub(crate) const QUILL_JS_URL: &str = "https://cdn.jsdelivr.net/npm/quill@2.0.3/dist/quill.js";
#[allow(dead_code)]
pub(crate) const QUILL_CSS_URL: &str =
"https://cdn.jsdelivr.net/npm/quill@2.0.3/dist/quill.snow.css";
#[allow(dead_code)]
pub(crate) const QUILL_JS_SRI: &str =
"sha384-utBUCeG4SYaCm4m7GQZYr8Hy8Fpy3V4KGjBZaf4WTKOcwhCYpt/0PfeEe3HNlwx8";
#[allow(dead_code)]
pub(crate) const QUILL_CSS_SRI: &str =
"sha384-ecIckRi4QlKYya/FQUbBUjS4qp65jF/J87Guw5uzTbO1C1Jfa/6kYmd6dXUF6D7i";
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn quill_constants_are_non_empty() {
assert_ne!(QUILL_JS_URL, "", "QUILL_JS_URL must not be empty");
assert_ne!(QUILL_CSS_URL, "", "QUILL_CSS_URL must not be empty");
assert_ne!(QUILL_JS_SRI, "", "QUILL_JS_SRI must not be empty");
assert_ne!(QUILL_CSS_SRI, "", "QUILL_CSS_SRI must not be empty");
}
#[test]
fn quill_urls_pin_to_2_0_3() {
assert!(QUILL_JS_URL.contains("@2.0.3/"));
assert!(QUILL_CSS_URL.contains("@2.0.3/"));
assert!(QUILL_JS_URL.ends_with("/quill.js"));
assert!(QUILL_CSS_URL.ends_with("/quill.snow.css"));
assert!(QUILL_JS_URL.starts_with("https://cdn.jsdelivr.net/"));
assert!(QUILL_CSS_URL.starts_with("https://cdn.jsdelivr.net/"));
}
#[test]
fn quill_sri_hashes_have_sha384_prefix_and_correct_length() {
assert!(
QUILL_JS_SRI.starts_with("sha384-"),
"QUILL_JS_SRI must use sha384 algorithm"
);
assert!(
QUILL_CSS_SRI.starts_with("sha384-"),
"QUILL_CSS_SRI must use sha384 algorithm"
);
assert_eq!(
QUILL_JS_SRI.len(),
71,
"QUILL_JS_SRI must be 71 chars: {QUILL_JS_SRI}"
);
assert_eq!(
QUILL_CSS_SRI.len(),
71,
"QUILL_CSS_SRI must be 71 chars: {QUILL_CSS_SRI}"
);
}
}