Added Jenkins file

This commit is contained in:
2024-07-30 15:11:31 -04:00
parent 734fc3ba2d
commit ba875ea171
3 changed files with 40 additions and 11 deletions

View File

@ -14,6 +14,7 @@ use uuid::Uuid;
pub struct MoreThanText {
id: Option<Uuid>,
tx: Sender<SendMsg>,
nodes: Vec<String>
}
impl MoreThanText {
@ -24,15 +25,15 @@ impl MoreThanText {
/// ```
/// use morethantext::MoreThanText;
///
/// MoreThanText::new();
/// MoreThanText::new(Vec::new());
/// ```
pub fn new() -> Self {
pub fn new(_nodes: Vec<String>) -> Self {
let (tx, rx) = channel();
spawn(move || {
let mut cache = Cache::new(rx);
cache.listen();
});
Self { id: None, tx: tx }
Self { id: None, tx: tx, nodes: Vec::new() }
}
/// Opens an existing or new session with the database.
@ -45,7 +46,7 @@ impl MoreThanText {
/// ```
/// use morethantext::MoreThanText;
///
/// let mut mtt = MoreThanText::new();
/// let mut mtt = MoreThanText::new(Vec::new());
/// mtt.open_session(None);
/// mtt.open_session(Some("7b1ff340-7dfa-4f29-b144-601384e54423".to_string()));
/// ```
@ -65,7 +66,7 @@ impl MoreThanText {
/// ```
/// use morethantext::MoreThanText;
///
/// let mut mtt = MoreThanText::new();
/// let mut mtt = MoreThanText::new(Vec::new());
/// mtt.get_id();
/// ```
pub fn get_id(&self) -> String {
@ -82,7 +83,7 @@ mod mtt_client {
#[test]
fn uniques_ids() {
let mut mtt = MoreThanText::new();
let mut mtt = MoreThanText::new(Vec::new());
let mut ids: Vec<Uuid> = Vec::new();
for _ in 1..10 {
mtt.open_session(None);
@ -96,7 +97,7 @@ mod mtt_client {
#[test]
fn existing_ids_are_reused() {
let mut mtt = MoreThanText::new();
let mut mtt = MoreThanText::new(Vec::new());
mtt.open_session(None);
let holder = mtt.id.clone().unwrap().to_string();
mtt.open_session(Some(holder.clone()));
@ -105,14 +106,14 @@ mod mtt_client {
#[test]
fn bad_ids_generate_new_ones() {
let mut mtt = MoreThanText::new();
let mut mtt = MoreThanText::new(Vec::new());
mtt.open_session(Some("bad test string".to_string()));
assert!(mtt.id.is_some());
}
#[test]
fn incorrect_ids_generate_new_ones() {
let mut mtt = MoreThanText::new();
let mut mtt = MoreThanText::new(Vec::new());
let holder = Uuid::new_v4();
mtt.open_session(Some(holder.clone().to_string()));
assert_ne!(mtt.id, Some(holder));