git-next/crates/repo-actor/src/tests.rs
Paul Campbell db9b4220ee
All checks were successful
Rust / build (push) Successful in 2m1s
ci/woodpecker/push/push-next Pipeline was successful
ci/woodpecker/push/cron-docker-builder Pipeline was successful
ci/woodpecker/push/tag-created Pipeline was successful
refactor: extract repo-actor and gitforge crates
2024-05-22 19:57:48 +01:00

43 lines
1.3 KiB
Rust

//
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()),
);
let dev_commit_history = vec![
git::Commit::new(
git::commit::Sha::new("dev".to_string()),
git::commit::Message::new("future".to_string()),
),
expected.clone(),
next.clone(),
git::Commit::new(
git::commit::Sha::new("current-main".to_string()),
git::commit::Message::new("history".to_string()),
),
];
let next_commit = find_next_commit_on_dev(next, dev_commit_history);
assert_eq!(next_commit, Some(expected), "Found the wrong commit");
}
}
mod webhook {
use super::super::webhook::*;
#[test]
fn should_split_ref() {
assert_eq!(split_ref("refs/heads/next"), ("refs/heads/", "next"));
}
}