git-next/crates/repo-actor/src/tests.rs

35 lines
1.1 KiB
Rust
Raw Normal View History

2024-05-14 07:59:31 +01:00
//
use super::*;
mod branch {
use super::super::branch::*;
use super::*;
#[actix_rt::test]
async fn test_find_next_commit_on_dev() {
let next = git::Commit::new(
git::commit::Sha::new("current-next".to_string()),
git::commit::Message::new("foo".to_string()),
);
let expected = git::Commit::new(
git::commit::Sha::new("dev-next".to_string()),
git::commit::Message::new("next-should-go-here".to_string()),
);
2024-05-14 07:59:31 +01:00
let dev_commit_history = vec![
git::Commit::new(
git::commit::Sha::new("dev".to_string()),
git::commit::Message::new("future".to_string()),
),
2024-05-14 07:59:31 +01:00
expected.clone(),
next.clone(),
git::Commit::new(
git::commit::Sha::new("current-main".to_string()),
git::commit::Message::new("history".to_string()),
),
2024-05-14 07:59:31 +01:00
];
let next_commit = find_next_commit_on_dev(next, dev_commit_history);
assert_eq!(next_commit, Some(expected), "Found the wrong commit");
}
}