From d5c72c27f04d4eef7dd41c8423433dfa07da8e05 Mon Sep 17 00:00:00 2001 From: Mike Penz Date: Sat, 6 Nov 2021 10:12:11 +0100 Subject: [PATCH] - sample showcase test for transform feature --- __tests__/fronius.test.ts | 24 ++++++++++ configs_test/configuration_fronius.json | 61 +++++++++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 __tests__/fronius.test.ts create mode 100644 configs_test/configuration_fronius.json diff --git a/__tests__/fronius.test.ts b/__tests__/fronius.test.ts new file mode 100644 index 00000000..8240af49 --- /dev/null +++ b/__tests__/fronius.test.ts @@ -0,0 +1,24 @@ +import {resolveConfiguration} from '../src/utils' +import {ReleaseNotesBuilder} from '../src/releaseNotesBuilder' + +jest.setTimeout(180000) + +it('Should properly generate changelog', async () => { + const configuration = resolveConfiguration('', 'configs_test/configuration_fronius.json') + const releaseNotesBuilder = new ReleaseNotesBuilder( + null, + '.', + 'ccremer', + 'charts', + null, + 'fronius-stack-0.2.0', + false, + true, + false, + configuration + ) + + const changeLog = await releaseNotesBuilder.build() + console.log(changeLog) + expect(changeLog).toStrictEqual(`1 changes since fronius-stack-0.1.2\n\n## 📄 Documentation\n\n- [fronius-stack] Bogus change to test changelog generator (#93)\n\n`) +}) diff --git a/configs_test/configuration_fronius.json b/configs_test/configuration_fronius.json new file mode 100644 index 00000000..f0eb887d --- /dev/null +++ b/configs_test/configuration_fronius.json @@ -0,0 +1,61 @@ +{ + "pr_template": "- ${{TITLE}} (#${{NUMBER}})", + "categories": [ + { + "title": "## 🚀 Features", + "labels": [ + "enhancement", + "feature" + ] + }, + { + "title": "## 🛠️ Minor Changes", + "labels": [ + "change" + ] + }, + { + "title": "## 🔎 Breaking Changes", + "labels": [ + "breaking" + ] + }, + { + "title": "## 🐛 Fixes", + "labels": [ + "bug", + "fix" + ] + }, + { + "title": "## 📄 Documentation", + "labels": [ + "documentation" + ] + }, + { + "title": "## 🔗 Dependency Updates", + "labels": [ + "dependency" + ] + } + ], + "template": "${{CATEGORIZED_COUNT}} changes since ${{FROM_TAG}}\n\n${{CHANGELOG}}", + "label_extractor": [ + { + "pattern": "^(?!\\[fronius-stack\\])", + "method": "replace", + "target": "ignore", + "on_property": "title" + } + ], + "tag_resolver": { + "filter": { + "pattern": "fronius-stack-(.+)" + }, + "transformer": { + "pattern": "fronius-stack-(.+)", + "target": "$1" + } + } + } \ No newline at end of file