Readded bad field type test.
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:
parent
2a324bff96
commit
b397cc4239
@ -4450,7 +4450,10 @@ impl DocumentFile {
|
||||
for oid in oids.clone().iter() {
|
||||
let doc = self.docs.get(oid).unwrap();
|
||||
let mut calc = calculation.clone();
|
||||
calc.add_value(doc.get(field_id).unwrap().clone());
|
||||
match calc.add_value(doc.get(field_id).unwrap().clone()) {
|
||||
Ok(_) => {},
|
||||
Err(err) => return err.into(),
|
||||
}
|
||||
if calc.calculate() == false.into() {
|
||||
oids.remove(oid);
|
||||
}
|
||||
@ -5042,23 +5045,25 @@ mod document_files {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
#[test]
|
||||
fn errors_on_bad_field_name() {
|
||||
let (docdef, doc_name) = create_docdef(Vec::new());
|
||||
let field_name = "wrong";
|
||||
let (queue, rx) = test_doc(doc_name.as_str(), docdef, standard_routes());
|
||||
let mut doc = TestDocument::new(Vec::new());
|
||||
doc.start();
|
||||
let doc_name = doc.get_docdef().get_document_name().clone();
|
||||
let queue = doc.get_queue();
|
||||
let rx = doc.get_receiver();
|
||||
let field_name = Name::english("wrong");
|
||||
let mut query = Query::new();
|
||||
let mut calc = Calculation::new(Operand::Equal);
|
||||
calc.add_value("something");
|
||||
query.add(field_name.to_string(), calc);
|
||||
query.add(field_name.clone(), calc);
|
||||
let msg = Message::new(doc_name, query);
|
||||
queue.send(msg).unwrap();
|
||||
let result = rx.recv_timeout(TIMEOUT).unwrap();
|
||||
let action = result.get_action();
|
||||
match action {
|
||||
MsgAction::Error(data) => match data {
|
||||
MTTError::DocumentFieldNotFound(output) => assert_eq!(output, field_name),
|
||||
MTTError::NameNotFound(output) => assert_eq!(output, &field_name),
|
||||
_ => unreachable!("got {:?}: should been field not found", data),
|
||||
},
|
||||
_ => unreachable!("got {:?}: should have been a error", action),
|
||||
@ -5073,15 +5078,15 @@ mod document_files {
|
||||
let mut calc = Calculation::new(Operand::Equal);
|
||||
calc.add_value("notUUID");
|
||||
let mut query = Query::new();
|
||||
query.add("field0".to_string(), calc);
|
||||
query.add(Name::english("field0"), calc);
|
||||
doc.send(query).unwrap();
|
||||
let result = doc.get_receiver().recv_timeout(TIMEOUT).unwrap();
|
||||
let action = result.get_action();
|
||||
match action {
|
||||
MsgAction::Error(data) => match data {
|
||||
MTTError::DocumentFieldWrongDataType(expected, got) => {
|
||||
assert_eq!(expected, &FieldType::Uuid);
|
||||
assert_eq!(got, &FieldType::StaticString);
|
||||
assert_eq!(got, &FieldType::Uuid);
|
||||
assert_eq!(expected, &FieldType::StaticString);
|
||||
}
|
||||
_ => unreachable!("got {:?}: should been field not found", data),
|
||||
},
|
||||
@ -5089,6 +5094,7 @@ mod document_files {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
#[test]
|
||||
fn can_use_default_values() {
|
||||
let (mut docdef, doc_name) = create_docdef([FieldType::StaticString].to_vec());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user