Skip to content

Commit

Permalink
Merge pull request #106 from Getdeck/improve-coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
tobifroe authored Jul 13, 2023
2 parents 1aaae60 + fa449ae commit 1cadfb5
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src-tauri/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,21 @@ pub trait Connector {
fn check_running(&self) -> Result<Vec<String>, ConnectError>;
fn terminate(&self, name: &str) -> Result<(), ConnectError>;
}

#[cfg(test)]
mod connection_tests {
#[test]
fn test_get_connector_context() {
let connector = super::get_connector_context("test", "GhostunnelDocker");
assert_eq!("test", connector.name);
let other = super::get_connector_context("other", "other");
assert_eq!("other", other.name);
}

#[test]
fn test_connecterror() {
let err = super::ConnectError::new("test");
assert_eq!("test", err.details);
assert_eq!(format!("{}", err), "test");
}
}
14 changes: 14 additions & 0 deletions src-tauri/tests/connectors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,18 @@ mod ghostunnel_docker_tests {
}
};
}
#[test]
fn test_d_check_not_running() {
let connector = get_connector_context("test", "GhostunnelDocker");
let _res = match connector.check_running() {
Ok(container_summary) => {
println!("{:?}", container_summary);
0
},
Err(why) => {
println!("{}", why);
1
}
};
}
}

0 comments on commit 1cadfb5

Please sign in to comment.