Skip to content

Commit

Permalink
feat: Change initial release to work as expected
Browse files Browse the repository at this point in the history
  • Loading branch information
cliedeman authored and christophwitzko committed Apr 25, 2020
1 parent 8afe7e8 commit f058d54
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
3 changes: 0 additions & 3 deletions pkg/semrel/semrel.go
Expand Up @@ -114,9 +114,6 @@ func CalculateChange(commits []*Commit, latestRelease *Release) Change {
}

func ApplyChange(version *semver.Version, change Change) *semver.Version {
if version.Major() == 0 {
change.Major = true
}
if !change.Major && !change.Minor && !change.Patch {
return nil
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/semrel/semrel_test.go
Expand Up @@ -41,9 +41,9 @@ func TestApplyChange(t *testing.T) {
expectedVersion string
}{
// No Previous Releases
{"0.0.0", NoChange, "1.0.0"},
{"0.0.0", PatchChange, "1.0.0"},
{"0.0.0", MinorChange, "1.0.0"},
{"0.0.0", NoChange, "0.0.0"},
{"0.0.0", PatchChange, "0.0.1"},
{"0.0.0", MinorChange, "0.1.0"},
{"0.0.0", MajorChange, "1.0.0"},

{"1.0.0", NoChange, ""},
Expand All @@ -68,7 +68,7 @@ func TestApplyChange(t *testing.T) {
actual := ApplyChange(current, tc.change)

// Handle no new version case
if actual != nil && tc.expectedVersion == "" {
if actual != nil && tc.expectedVersion != "" {
if actual.String() != tc.expectedVersion {
t.Errorf("expected: %s, got: %s", tc.expectedVersion, actual)
}
Expand Down

0 comments on commit f058d54

Please sign in to comment.