Skip to content

Commit

Permalink
Add unit tests in SupportBranchScenarios
Browse files Browse the repository at this point in the history
  • Loading branch information
enriqueraso authored and asbjornu committed Jan 20, 2023
1 parent 7576b44 commit 3a6b123
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
Expand Up @@ -71,4 +71,31 @@ public void WhenSupportIsBranchedAndTaggedFromAnotherSupportEnsureNewMinorIsUsed

fixture.AssertFullSemver("1.3.1+2");
}

[Test]
public void WhenSupportIsBranchedFromMainWithSpecificTag()
{
using var fixture = new EmptyRepositoryFixture();
fixture.Repository.MakeACommit();
fixture.AssertFullSemver("0.1.0+0");

fixture.Repository.ApplyTag("1.4.0-rc");
fixture.Repository.MakeACommit();
fixture.Repository.CreateBranch("support/1");
Commands.Checkout(fixture.Repository, "support/1");
fixture.AssertFullSemver("1.4.0+1");
}

[Test]
public void WhenSupportIsBranchedFromMainWithSpecificTagOnCommit()
{
using var fixture = new EmptyRepositoryFixture();
fixture.Repository.MakeACommit();
fixture.AssertFullSemver("0.1.0+0");

fixture.Repository.ApplyTag("1.4.0-rc");
fixture.Repository.CreateBranch("support/1");
Commands.Checkout(fixture.Repository, "support/1");
fixture.AssertFullSemver("1.4.0");
}
}
Expand Up @@ -97,6 +97,12 @@ public NextVersion FindVersion()
{
// set the commit count on the tagged ver
taggedSemanticVersion.BuildMetaData.CommitsSinceVersionSource = semver.BuildMetaData?.CommitsSinceVersionSource;

// set the updated prerelease tag when it doesn't match with prerelease tag defined in branch configuration
if (preReleaseTagDoesNotMatchConfiguration)
{
taggedSemanticVersion.PreReleaseTag = semver.PreReleaseTag;
}
}
}

Expand Down

0 comments on commit 3a6b123

Please sign in to comment.