Skip to content

Commit

Permalink
test: add test for autobumping a breaking change on 0.y.z
Browse files Browse the repository at this point in the history
  • Loading branch information
tranzystorekk authored and oknozor committed Oct 11, 2020
1 parent f113744 commit 67a736c
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,44 @@ mod test {
assert_eq!(version.unwrap(), Version::new(2, 0, 0))
}

#[test]
fn should_get_next_auto_version_breaking_changes_on_initial_dev_version() {
let feature = Commit {
oid: "1234".to_string(),
message: CommitMessage {
commit_type: CommitType::Feature,
scope: None,
body: None,
footer: None,
description: "feature".to_string(),
is_breaking_change: false,
},
author: "".to_string(),
date: Utc::now().naive_local(),
};

let breaking_change = Commit {
oid: "1234".to_string(),
message: CommitMessage {
commit_type: CommitType::Feature,
scope: None,
body: None,
footer: None,
description: "feature".to_string(),
is_breaking_change: true,
},
author: "".to_string(),
date: Utc::now().naive_local(),
};

let version = VersionIncrement::get_next_auto_version(
&Version::parse("0.1.0").unwrap(),
&[breaking_change, feature],
);

assert_eq!(version.unwrap(), Version::new(0, 2, 0))
}

#[test]
fn should_get_next_auto_version_minor() {
let patch = Commit {
Expand Down

0 comments on commit 67a736c

Please sign in to comment.