Readded add with bad field name test.
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 1s

This commit is contained in:
Jeff Baskin 2025-10-16 09:07:38 -04:00
parent 3fd6bafd33
commit f69d5d2248

View File

@ -4467,6 +4467,10 @@ mod document_files {
} }
} }
fn get_docdef(&self) -> &DocDef {
&self.docdef
}
fn get_docdef_mut(&mut self) -> &mut DocDef { fn get_docdef_mut(&mut self) -> &mut DocDef {
&mut self.docdef &mut self.docdef
} }
@ -4704,26 +4708,26 @@ mod document_files {
assert!(entries.is_empty(), "did not use {:?}", entries); assert!(entries.is_empty(), "did not use {:?}", entries);
} }
/*
#[test] #[test]
fn errors_on_wrong_field_name() { fn errors_on_wrong_field_name() {
let (docdef, doc_name) = create_docdef([FieldType::Uuid].to_vec()); let mut test_doc = TestDocument::new(Vec::new());
let field_name = Uuid::new_v4().to_string(); test_doc.start();
let (queue, rx) = test_doc(doc_name.as_str(), docdef, standard_routes()); let queue = test_doc.get_queue();
let name = Name::english("bad".to_string());
let mut addition = Addition::new(); let mut addition = Addition::new();
addition.add_field(field_name.clone(), Uuid::new_v4()); addition.add_field(name.clone(), "doesn't matter");
let msg = Message::new(doc_name, addition); queue.send(Message::new(test_doc.get_docdef().get_document_name(), addition)).unwrap();
queue.send(msg).unwrap(); let result = test_doc.get_receiver().recv_timeout(TIMEOUT).unwrap();
let result = rx.recv_timeout(TIMEOUT).unwrap();
match result.get_action() { match result.get_action() {
MsgAction::Error(err) => match err { MsgAction::Error(err) => match err {
MTTError::DocumentFieldNotFound(data) => assert_eq!(data, &field_name), MTTError::NameNotFound(data) => assert_eq!(data, &name),
_ => unreachable!("got {:?}: should have been document field not found.", err), _ => unreachable!("got {:?}: should have been document field not found.", err),
}, },
_ => unreachable!("got {:?}: should have been an error", result.get_action()), _ => unreachable!("got {:?}: should have been an error", result.get_action()),
} }
} }
/*
#[test] #[test]
fn errors_on_wrong_field_type() { fn errors_on_wrong_field_type() {
let (docdef, doc_name) = create_docdef([FieldType::Uuid].to_vec()); let (docdef, doc_name) = create_docdef([FieldType::Uuid].to_vec());