Moved failed to find document into lib tests.
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 1s

This commit is contained in:
2026-02-25 13:44:43 -05:00
parent 5251689158
commit 97f9d24330
8 changed files with 50 additions and 37 deletions

View File

@@ -2,7 +2,7 @@ mod support;
use morethantext::{
action::{Addition, DocDef, Field, FieldType, Query},
ErrorID, MoreThanText, Name,
ErrorID, MTTError, MoreThanText, Name,
};
use std::collections::HashSet;
use support::random_name;
@@ -43,13 +43,18 @@ fn can_new_documents_be_added() {
}
#[test]
#[ignore = "need to alter error"]
fn does_it_error_on_a_bad_field_name() {
fn does_it_error_on_a_bad_document_name() {
let mut mtt = MoreThanText::new();
let doc_name = Name::english("empty");
mtt.create_document(DocDef::new(doc_name.clone()));
let mut add = Addition::new(doc_name.clone());
add.add_field(Name::english("missing"), "stuff");
let mut expected = MTTError::new(ErrorID::NameNotFound(doc_name.clone().into()));
expected.add_parent(ErrorID::Document(doc_name.clone().into()));
let add = Addition::new(doc_name.clone());
let result = mtt.records(add).unwrap_err();
assert_eq!(result.to_string(), expected.to_string());
/*
let result = mtt
.records(add)
.unwrap_err()
@@ -58,10 +63,11 @@ fn does_it_error_on_a_bad_field_name() {
.unwrap()
.clone();
match result {
ErrorID::NameNotFound => {}
ErrorID::NameNotFound(_) => {}
_ => unreachable!(
"got {:?}: should have been document field not found.",
result
),
}
*/
}