0.0.1-alpha.5.fix.1
This commit is contained in:
27
crates/knowledge-domain-lib/unit_tests/source.rs
Normal file
27
crates/knowledge-domain-lib/unit_tests/source.rs
Normal file
@@ -0,0 +1,27 @@
|
||||
// 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;
|
||||
}
|
||||
Reference in New Issue
Block a user