Made a specific id for names.
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:
@@ -2,7 +2,7 @@ use crate::{
|
||||
action::{Action, MsgAction},
|
||||
message::{wrapper::Message, MessageAction},
|
||||
mtterror::MTTError,
|
||||
name::{Name, NameType, Names},
|
||||
name::{Name, NameID, NameType, Names},
|
||||
queue::router::Queue,
|
||||
};
|
||||
use std::{
|
||||
@@ -51,7 +51,7 @@ mod includes {
|
||||
pub enum RegMsg {
|
||||
AddRoute(Path),
|
||||
AddDocName(Vec<Name>),
|
||||
DocumentNameID(Uuid),
|
||||
DocumentNameID(NameID),
|
||||
Error(MTTError),
|
||||
GetNameID(Name),
|
||||
Ok,
|
||||
@@ -94,13 +94,15 @@ impl MessageAction for Register {}
|
||||
#[cfg(test)]
|
||||
mod registries {
|
||||
use super::*;
|
||||
use crate::name::name_id_support::test_name_id;
|
||||
|
||||
#[test]
|
||||
fn does_registry_store_data() {
|
||||
let id = Uuid::new_v4();
|
||||
let name_id = test_name_id();
|
||||
let sender_data_id = Uuid::new_v4();
|
||||
let inputs = [
|
||||
RegMsg::DocumentNameID(id.clone()),
|
||||
RegMsg::RemoveSender(id.clone()),
|
||||
RegMsg::DocumentNameID(name_id.clone()),
|
||||
RegMsg::RemoveSender(sender_data_id.clone()),
|
||||
];
|
||||
for regmsg in inputs.iter() {
|
||||
let sender_id = Uuid::new_v4();
|
||||
@@ -108,7 +110,8 @@ mod registries {
|
||||
assert_eq!(reg.doc_name(), &NameType::None);
|
||||
assert_eq!(reg.get_sender_id(), &sender_id);
|
||||
match reg.get_msg() {
|
||||
RegMsg::DocumentNameID(data) | RegMsg::RemoveSender(data) => assert_eq!(data, &id),
|
||||
RegMsg::DocumentNameID(data) => assert_eq!(data, &name_id),
|
||||
RegMsg::RemoveSender(data) => assert_eq!(data, &sender_data_id),
|
||||
_ => unreachable!("should have been one of the inputs"),
|
||||
}
|
||||
}
|
||||
@@ -196,12 +199,12 @@ mod paths {
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub struct Route {
|
||||
pub action: Include<Action>,
|
||||
pub doc_id: Include<Uuid>,
|
||||
pub doc_id: Include<NameID>,
|
||||
pub msg_id: Include<Uuid>,
|
||||
}
|
||||
|
||||
impl Route {
|
||||
pub fn new(msg_id: Include<Uuid>, doc: Include<Uuid>, action: Include<Action>) -> Self {
|
||||
pub fn new(msg_id: Include<Uuid>, doc: Include<NameID>, action: Include<Action>) -> Self {
|
||||
Self {
|
||||
action: action,
|
||||
doc_id: doc,
|
||||
@@ -248,7 +251,7 @@ impl From<&RouteID> for Route {
|
||||
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
|
||||
pub struct RouteID {
|
||||
action: Option<Action>,
|
||||
doc_id: Option<Uuid>,
|
||||
doc_id: Option<NameID>,
|
||||
msg_id: Option<Uuid>,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user