Skip to content

Commit

Permalink
GH-2587 - added tests to test the 'master' branch name replaced with …
Browse files Browse the repository at this point in the history
…'main'
  • Loading branch information
arturcic committed Feb 8, 2021
1 parent 7116ada commit 80adc3f
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/GitVersion.Core.Tests/Configuration/ConfigProviderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,44 @@ public void CanProvideConfigForNewBranch()
config.Branches["bug"].Tag.ShouldBe("bugfix");
}

[Test]
public void MasterConfigReplacedWithMain()
{
const string text = @"
next-version: 2.0.0
branches:
master:
regex: '^master$|^main$'
tag: beta";
SetupConfigFileContent(text);

var config = configProvider.Provide(repoPath);

config.Branches[MainBranch].Regex.ShouldBe("^master$|^main$");
config.Branches[MainBranch].Tag.ShouldBe("beta");
}

[Test]
public void MasterConfigReplacedWithMainInSourceBranches()
{
const string text = @"
next-version: 2.0.0
branches:
breaking:
regex: breaking[/]
mode: ContinuousDeployment
increment: Major
source-branches: ['master']
is-release-branch: false";
SetupConfigFileContent(text);

var config = configProvider.Provide(repoPath);

config.Branches["breaking"].Regex.ShouldBe("breaking[/]");
config.Branches["breaking"].SourceBranches.ShouldHaveSingleItem();
config.Branches["breaking"].SourceBranches.ShouldContain(MainBranch);
}

[Test]
public void NextVersionCanBeInteger()
{
Expand Down

0 comments on commit 80adc3f

Please sign in to comment.