2026-02-06 12:06:51 -05:00
|
|
|
use morethantext::{
|
2026-02-06 13:07:34 -05:00
|
|
|
action::{DocDef, FieldType, Query},
|
2026-02-12 22:49:19 -05:00
|
|
|
ErrorID, MTTError, MoreThanText, Name,
|
2026-02-06 12:06:51 -05:00
|
|
|
};
|
|
|
|
|
use uuid::Uuid;
|
2026-02-03 11:37:58 -05:00
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
fn errors_on_missing_page() {
|
|
|
|
|
let mtt = MoreThanText::new();
|
|
|
|
|
let doc_name = "missing";
|
2026-02-06 12:06:51 -05:00
|
|
|
match mtt.get_document(doc_name, "something") {
|
2026-02-03 11:37:58 -05:00
|
|
|
Ok(data) => assert!(false, "got '{}', should have been not found error", data),
|
2026-02-12 22:49:19 -05:00
|
|
|
Err(err) => {
|
|
|
|
|
let err_id = err.error_id();
|
|
|
|
|
match err_id {
|
|
|
|
|
ErrorID::DocumentNotFound => {}
|
|
|
|
|
_ => unreachable!("got {:?}, should have been not found", err),
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-02-03 11:37:58 -05:00
|
|
|
}
|
|
|
|
|
}
|
2026-02-06 12:06:51 -05:00
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
fn can_create_document() {
|
|
|
|
|
let mut mtt = MoreThanText::new();
|
|
|
|
|
let doc_name = Name::english(Uuid::new_v4().to_string().as_str());
|
|
|
|
|
let mut docdef = DocDef::new(doc_name.clone());
|
|
|
|
|
let field_name = Name::english(Uuid::new_v4().to_string().as_str());
|
|
|
|
|
docdef.add_field(field_name.clone(), FieldType::Uuid);
|
|
|
|
|
mtt.request(docdef);
|
|
|
|
|
}
|