Built new error module to hold document name.
Some checks failed
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 1s

This commit is contained in:
2026-02-12 12:24:20 -05:00
parent 564602b766
commit 7ff9ca340f
7 changed files with 111 additions and 22 deletions

View File

@@ -28,12 +28,12 @@ pub enum MsgAction {
}
impl MessageAction for MsgAction {
fn doc_name(&self) -> NameType {
fn doc_name(&self) -> &NameType {
match self {
Self::Addition(data) => data.doc_name(),
Self::Query(data) => data.doc_name(),
Self::Create(data) => data.doc_name(),
_ => NameType::None,
_ => &NameType::None,
}
}
}
@@ -144,10 +144,11 @@ mod msgactions {
#[test]
fn turn_query_into_action() {
let name = Name::english(Uuid::new_v4().to_string().as_str());
let expected_name: NameType = name.clone().into();
let value = Query::new(name.clone());
let result: MsgAction = value.into();
match result {
MsgAction::Query(data) => assert_eq!(data.doc_name(), name.into()),
MsgAction::Query(data) => assert_eq!(data.doc_name(), &expected_name),
_ => unreachable!("Got {:?}: dhould have been query", result),
}
}