Files

28 lines
881 B
Rust

// file: crates/knowledge-domain-lib/unit_tests/source.rs
// version: 1
#[test]
fn source_id_rejects_empty_values() {
assert_eq!(crate::SourceId::new(" "), Err(crate::SourceIdError::Empty));
return;
}
#[test]
fn source_id_constructs_and_exposes_valid_values() {
let source_id = crate::SourceId::new("pgr");
assert_eq!(source_id.as_ref().map(crate::SourceId::as_str), Ok("pgr"));
return;
}
#[test]
fn content_sources_are_not_limited_to_three_repositories() {
let sources = [
crate::ContentSource::new("pgr", crate::ContentFamily::Pgr),
crate::ContentSource::new("howtos", crate::ContentFamily::Howto),
crate::ContentSource::new("snippets", crate::ContentFamily::Snippet),
crate::ContentSource::new("project-extra", crate::ContentFamily::ProjectLocal),
];
assert!(sources.iter().all(Result::is_ok));
return;
}