- introduce new match mechanism for the label_extractor. Allowed replace (default) vs match

- introduce new test case to verify match behavior
This commit is contained in:
Mike Penz
2021-08-26 16:41:45 +02:00
parent a753722e84
commit d8f61a957d
6 changed files with 83 additions and 24 deletions
+30
View File
@@ -134,3 +134,33 @@ it('Extract label from title, split regex', async () => {
expect(resultChangelog).toStrictEqual(`## 🚀 Features\n\n- [Feature][AB-1234] - this is a PR 1 title message\n - PR: #1\n- [Issue][Feature][AB-1234321] - this is a PR 3 title message\n - PR: #3\n\n## 🐛 Fixes\n\n- [Issue][AB-4321] - this is a PR 2 title message\n - PR: #2\n- [Issue][Feature][AB-1234321] - this is a PR 3 title message\n - PR: #3\n\n`)
})
it('Extract label from title, match', async () => {
configuration.label_extractor = [
{
"pattern": "\\[Feature\\]",
"on_property": "title",
"method": "match"
},
{
"pattern": "\\[Issue\\]",
"on_property": "title",
"method": "match"
}
]
const resultChangelog = buildChangelog(
mergedPullRequests,
{
owner: "mikepenz",
repo: "test-repo",
fromTag: "1.0.0",
toTag: "2.0.0",
failOnError: false,
commitMode: false,
configuration: configuration
}
)
expect(resultChangelog).toStrictEqual(`## 🚀 Features\n\n- [Feature][AB-1234] - this is a PR 1 title message\n - PR: #1\n- [Issue][Feature][AB-1234321] - this is a PR 3 title message\n - PR: #3\n\n## 🐛 Fixes\n\n- [Issue][AB-4321] - this is a PR 2 title message\n - PR: #2\n- [Issue][Feature][AB-1234321] - this is a PR 3 title message\n - PR: #3\n\n`)
})