Moved create document testing into library tests.
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 1s
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 1s
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use morethantext::{action::*, MoreThanText, TestMoreThanText};
|
||||
use morethantext::{action::*, ErrorID, Name, MoreThanText, TestMoreThanText};
|
||||
use uuid::Uuid;
|
||||
|
||||
#[test]
|
||||
@@ -7,4 +7,21 @@ fn is_document_created() {
|
||||
let doc_name = TestMoreThanText::random_name();
|
||||
let docdef = DocDef::new(doc_name.clone());
|
||||
mtt.create_document(docdef).unwrap();
|
||||
let qry = Query::new(doc_name);
|
||||
let result = mtt.records(qry).unwrap();
|
||||
assert_eq!(result.len(), 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn are_errors_produced_for_duplicate_names() {
|
||||
let mut mtt = MoreThanText::new();
|
||||
let docdef = DocDef::new(Name::english("duplicate"));
|
||||
mtt.create_document(docdef.clone()).unwrap();
|
||||
match mtt.create_document(docdef) {
|
||||
Ok(_) => assert!(false, "should have failed"),
|
||||
Err(err) => match err.error_id() {
|
||||
ErrorID::NameAlreadyExists => {},
|
||||
_ => unreachable!("got {:?}, should be name already exists", err),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user