From c3a5e50ad539387d276518df2d49bca2e30d6623 Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Fri, 17 May 2024 20:30:28 +0100 Subject: [PATCH] test(git): add more tests --- crates/git/src/lib.rs | 3 +++ crates/git/src/tests.rs | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 crates/git/src/tests.rs diff --git a/crates/git/src/lib.rs b/crates/git/src/lib.rs index 1fea917..6427946 100644 --- a/crates/git/src/lib.rs +++ b/crates/git/src/lib.rs @@ -9,6 +9,9 @@ mod repo_details; pub mod repository; pub mod validate; +#[cfg(test)] +mod tests; + pub use commit::Commit; pub use fetch::fetch; pub use generation::Generation; diff --git a/crates/git/src/tests.rs b/crates/git/src/tests.rs new file mode 100644 index 0000000..9f2ebe9 --- /dev/null +++ b/crates/git/src/tests.rs @@ -0,0 +1,20 @@ +mod commit { + use crate::{commit, Commit}; + + #[test] + fn should_return_sha() { + let sha = commit::Sha::new("sha".to_string()); + let message = commit::Message::new("message".to_string()); + let commit = Commit::new(sha.clone(), message); + + assert_eq!(commit.sha(), &sha); + } + #[test] + fn should_return_message() { + let sha = commit::Sha::new("sha".to_string()); + let message = commit::Message::new("message".to_string()); + let commit = Commit::new(sha, message.clone()); + + assert_eq!(commit.message(), &message); + } +}