|
1 | 1 | package com.monta.changelog.git |
2 | 2 |
|
| 3 | +import com.monta.changelog.model.ConventionalCommitType |
3 | 4 | import io.kotest.core.spec.style.StringSpec |
4 | 5 | import io.kotest.matchers.nulls.shouldBeNull |
5 | 6 | import io.kotest.matchers.nulls.shouldNotBeNull |
@@ -107,6 +108,41 @@ class CommitMapperTest : |
107 | 108 | commit.shouldBeNull() |
108 | 109 | } |
109 | 110 |
|
| 111 | + "should map build commit type" { |
| 112 | + val logItem = LogItem( |
| 113 | + author = Author(date = "2026-01-12", email = "test@test.com", name = "Test"), |
| 114 | + committer = Author(date = "2026-01-12", email = "test@test.com", name = "Test"), |
| 115 | + commit = "abc123", |
| 116 | + subject = "build(deps): bump kotlin to 2.0", |
| 117 | + body = "", |
| 118 | + parents = "parent1" |
| 119 | + ) |
| 120 | + |
| 121 | + val commit = mapper.fromGitLogItem(logItem) |
| 122 | + |
| 123 | + commit.shouldNotBeNull() |
| 124 | + commit.type shouldBe ConventionalCommitType.Build |
| 125 | + commit.scope shouldBe "deps" |
| 126 | + commit.message shouldBe "bump kotlin to 2.0" |
| 127 | + } |
| 128 | + |
| 129 | + "should map revert commit type" { |
| 130 | + val logItem = LogItem( |
| 131 | + author = Author(date = "2026-01-12", email = "test@test.com", name = "Test"), |
| 132 | + committer = Author(date = "2026-01-12", email = "test@test.com", name = "Test"), |
| 133 | + commit = "abc123", |
| 134 | + subject = "revert: undo previous change", |
| 135 | + body = "", |
| 136 | + parents = "parent1" |
| 137 | + ) |
| 138 | + |
| 139 | + val commit = mapper.fromGitLogItem(logItem) |
| 140 | + |
| 141 | + commit.shouldNotBeNull() |
| 142 | + commit.type shouldBe ConventionalCommitType.Revert |
| 143 | + commit.message shouldBe "undo previous change" |
| 144 | + } |
| 145 | + |
110 | 146 | "should map commit with double quotes in subject" { |
111 | 147 | val logItem = LogItem( |
112 | 148 | author = Author(date = "2026-01-12", email = "test@test.com", name = "Test"), |
|
0 commit comments