test(git): add more tests
All checks were successful
Rust / build (push) Successful in 1m18s
ci/woodpecker/push/tag-created Pipeline was successful
ci/woodpecker/push/push-next Pipeline was successful

This commit is contained in:
Paul Campbell 2024-05-17 20:30:28 +01:00
parent 896e1cba42
commit c3a5e50ad5
2 changed files with 23 additions and 0 deletions

View file

@ -9,6 +9,9 @@ mod repo_details;
pub mod repository; pub mod repository;
pub mod validate; pub mod validate;
#[cfg(test)]
mod tests;
pub use commit::Commit; pub use commit::Commit;
pub use fetch::fetch; pub use fetch::fetch;
pub use generation::Generation; pub use generation::Generation;

20
crates/git/src/tests.rs Normal file
View file

@ -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);
}
}