Moved the index update tests to lib testing.
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:
@@ -118,7 +118,7 @@ impl Index {
|
||||
}
|
||||
};
|
||||
if self.unique && oids.len() > 0 {
|
||||
let err = MTTError::new(ErrorID::IndexEntryAlreadyExists);
|
||||
let err = MTTError::new(ErrorID::IndexEntryAlreadyExists(field.clone()));
|
||||
return Err(err);
|
||||
} else {
|
||||
oids.insert(oid);
|
||||
@@ -160,7 +160,7 @@ impl Index {
|
||||
if self.unique {
|
||||
match self.data.get(field) {
|
||||
Some(_) => {
|
||||
let err = MTTError::new(ErrorID::IndexEntryAlreadyExists);
|
||||
let err = MTTError::new(ErrorID::IndexEntryAlreadyExists(field.clone()));
|
||||
return Err(err);
|
||||
}
|
||||
None => {}
|
||||
@@ -327,7 +327,7 @@ mod indexes {
|
||||
Err(err) => {
|
||||
let err_id = err.get_error_ids().back().unwrap();
|
||||
match err_id {
|
||||
ErrorID::IndexEntryAlreadyExists => {}
|
||||
ErrorID::IndexEntryAlreadyExists(data) => assert_eq!(data, &field),
|
||||
_ => unreachable!("got {:?}: should have been duplicate field", err),
|
||||
}
|
||||
}
|
||||
@@ -355,7 +355,7 @@ mod indexes {
|
||||
match index.validate(&field) {
|
||||
Ok(_) => unreachable!("should have gotten a duplication error"),
|
||||
Err(err) => match err.get_error_ids().back().unwrap() {
|
||||
ErrorID::IndexEntryAlreadyExists => {}
|
||||
ErrorID::IndexEntryAlreadyExists(data) => assert_eq!(data, &field),
|
||||
_ => unreachable!("got {:?}: should have been duplicate field", err),
|
||||
},
|
||||
}
|
||||
@@ -1846,7 +1846,6 @@ mod document_files {
|
||||
_ => unreachable!("got {:?}: should have gotten an error", action),
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
#[test]
|
||||
fn does_update_maintain_unique_fields() {
|
||||
@@ -1892,7 +1891,7 @@ mod document_files {
|
||||
let action = result.get_action();
|
||||
match action {
|
||||
MsgAction::Error(err) => match err.get_error_ids().back().unwrap() {
|
||||
ErrorID::IndexEntryAlreadyExists => {}
|
||||
ErrorID::IndexEntryAlreadyExists(_) => {}
|
||||
_ => unreachable!("got {:?}: should have gotten incorrect file type", err),
|
||||
},
|
||||
_ => unreachable!("got {:?}: should have gotten an error", action),
|
||||
@@ -1979,7 +1978,7 @@ mod document_files {
|
||||
let action = result.get_action();
|
||||
match action {
|
||||
MsgAction::Error(err) => match err.get_error_ids().back().unwrap() {
|
||||
ErrorID::IndexEntryAlreadyExists => {}
|
||||
ErrorID::IndexEntryAlreadyExists(_) => {}
|
||||
_ => unreachable!("got {:?}: should have gotten an missing field", err),
|
||||
},
|
||||
_ => unreachable!("got {:?}: should have gotten an error", action),
|
||||
@@ -2020,7 +2019,7 @@ mod document_files {
|
||||
let action = result.get_action();
|
||||
match action {
|
||||
MsgAction::Error(err) => match err.get_error_ids().back().unwrap() {
|
||||
ErrorID::IndexEntryAlreadyExists => {}
|
||||
ErrorID::IndexEntryAlreadyExists(_) => {}
|
||||
_ => unreachable!("got {:?}: should have gotten field duplicate", err),
|
||||
},
|
||||
_ => unreachable!("got {:?}: should have gotten an error", action),
|
||||
@@ -2046,6 +2045,7 @@ mod document_files {
|
||||
}
|
||||
assert!(ids.is_empty(), "did not find {:?}", ids);
|
||||
}
|
||||
*/
|
||||
|
||||
#[test]
|
||||
fn can_calculate_field_values() {
|
||||
|
||||
Reference in New Issue
Block a user