Skip to content

Commit

Permalink
chore(tests): test log with only_first_parent
Browse files Browse the repository at this point in the history
  • Loading branch information
Éric BURGHARD committed Oct 8, 2023
1 parent 606d831 commit 25684ef
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/lib_tests/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use cocogitto::CocoGitto;
use crate::helpers::*;

use anyhow::Result;
use cmd_lib::run_cmd;
use sealed_test::prelude::*;
use speculoos::prelude::*;

Expand Down Expand Up @@ -48,3 +49,31 @@ fn get_log_with_no_errors() -> Result<()> {

Ok(())
}

#[sealed_test]
fn get_log_on_master_only() -> Result<()> {
// Arrange
git_init()?;
let settings = r#"only_first_parent = true"#;
run_cmd!(echo $settings > cog.toml;)?;
git_commit("chore: initial commit")?;

run_cmd!(git checkout -b feature)?;
git_commit("feat: a commit on feature branch")?;
git_commit("fix: a commit on feature branch")?;
run_cmd!(
git checkout master;
git merge --no-ff -m "feat: feature" feature;
)?;

let filters = CommitFilters(vec![CommitFilter::NoError]);
let cocogitto = CocoGitto::get()?;

// Act
let logs = cocogitto.get_log(filters)?;

// Assert we don't see feature branch commit
assert_that!(logs).does_not_contain("a commit on feature branch");

Ok(())
}

0 comments on commit 25684ef

Please sign in to comment.