Built new error module to hold document name.
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:
@@ -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),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user