Skip to content
Snippets Groups Projects
Commit b76f53a5 authored by timoknapp's avatar timoknapp Committed by Christoph Witzko
Browse files

test: add test for 'prettified_output' config

parent 399e0b45
No related branches found
No related tags found
No related merge requests found
## 2.0.0 (2020-11-11)
#### Breaking Changes
* commit message (12345678)
```
BREAKING CHANGE: test
```
* **user:** another commit message (12345679)
```
changed ID int into UUID
```
#### Feature
* **app:** commit message (12345678)
#### Bug Fixes
* commit message (abcd)
#### Build
* commit message (43218765)
#### CI
* commit message (87654321)
#### yolo
* **swag:** commit message (12345678)
......@@ -35,3 +35,34 @@ func TestDefaultGenerator(t *testing.T) {
t.Fail()
}
}
func TestPrettifiedGenerator(t *testing.T) {
changelogConfig := &generator.ChangelogGeneratorConfig{}
changelogConfig.Commits = []*semrel.Commit{
{},
{SHA: "123456789", Type: "feat", Scope: "app", Message: "commit message"},
{SHA: "abcd", Type: "fix", Scope: "", Message: "commit message"},
{SHA: "87654321", Type: "ci", Scope: "", Message: "commit message"},
{SHA: "43218765", Type: "build", Scope: "", Message: "commit message"},
{SHA: "12345678", Type: "yolo", Scope: "swag", Message: "commit message"},
{SHA: "12345678", Type: "chore", Scope: "", Message: "commit message", Raw: []string{"", "BREAKING CHANGE: test"}, Change: &semrel.Change{Major: true}},
{SHA: "12345679", Type: "chore!", Scope: "user", Message: "another commit message", Raw: []string{"another commit message", "changed ID int into UUID"}, Change: &semrel.Change{Major: true}},
{SHA: "stop", Type: "chore", Scope: "", Message: "not included"},
}
changelogConfig.LatestRelease = &semrel.Release{SHA: "stop"}
changelogConfig.NewVersion = "2.0.0"
generator := &DefaultChangelogGenerator{prettifiedOutput: true}
changelog := generator.Generate(changelogConfig)
if !strings.Contains(changelog, "* **app:** commit message (12345678)") ||
!strings.Contains(changelog, "* commit message (abcd)") ||
!strings.Contains(changelog, "#### 🎁 Feature") ||
!strings.Contains(changelog, "#### 🐞 Bug Fixes") ||
!strings.Contains(changelog, "#### 🔁 CI") ||
!strings.Contains(changelog, "#### 📦 Build") ||
!strings.Contains(changelog, "#### 📣 Breaking Changes") ||
!strings.Contains(changelog, "#### yolo") ||
!strings.Contains(changelog, "```\nBREAKING CHANGE: test\n```") ||
strings.Contains(changelog, "not included") {
t.Fail()
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment