diff --git a/crates/git/src/lib.rs b/crates/git/src/lib.rs index 1fea9175..64279467 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 00000000..9f2ebe9c --- /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); + } +}