-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: types with ! should be breaking changes
closes #22 Signed-off-by: Carlos A Becker <caarlos0@gmail.com>
- Loading branch information
Showing
5 changed files
with
110 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
package main | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/matryer/is" | ||
) | ||
|
||
func TestIsBreaking(t *testing.T) { | ||
for _, log := range []string{ | ||
"feat!: foo", | ||
"chore(lala)!: foo", | ||
"docs: lalala\nBREAKING CHANGE: lalal", | ||
} { | ||
t.Run(log, func(t *testing.T) { | ||
is.New(t).True(isBreaking(log)) // should be a major change | ||
}) | ||
} | ||
|
||
for _, log := range []string{ | ||
"feat: foo", | ||
"chore(lol): foo", | ||
"docs: lalala", | ||
} { | ||
t.Run(log, func(t *testing.T) { | ||
is.New(t).True(!isBreaking(log)) // should NOT be a major change | ||
}) | ||
} | ||
} | ||
|
||
func TestIsFeature(t *testing.T) { | ||
for _, log := range []string{ | ||
"feat: foo", | ||
"feat(lalal): foobar", | ||
} { | ||
t.Run(log, func(t *testing.T) { | ||
is.New(t).True(isFeature(log)) // should be a minor change | ||
}) | ||
} | ||
|
||
for _, log := range []string{ | ||
"fix: foo", | ||
"chore: foo", | ||
"docs: lalala", | ||
} { | ||
t.Run(log, func(t *testing.T) { | ||
is.New(t).True(!isFeature(log)) // should NOT be a minor change | ||
}) | ||
} | ||
} | ||
|
||
func TestIsPatch(t *testing.T) { | ||
for _, log := range []string{ | ||
"fix: foo", | ||
"fix(lalal): lalala", | ||
} { | ||
t.Run(log, func(t *testing.T) { | ||
is.New(t).True(isPatch(log, false)) // should be a patch change | ||
}) | ||
} | ||
|
||
for _, log := range []string{ | ||
"chore: foobar", | ||
"docs: something", | ||
"invalid commit", | ||
} { | ||
t.Run(log, func(t *testing.T) { | ||
is.New(t).True(!isPatch(log, false)) // should NOT be a patch change | ||
}) | ||
} | ||
|
||
for _, log := range []string{ | ||
"chore: foobar", | ||
"docs: something", | ||
"invalid commit", | ||
} { | ||
t.Run(log+" (force)", func(t *testing.T) { | ||
is.New(t).True(isPatch(log, true)) // should NOT be a patch change | ||
}) | ||
} | ||
} |