diff --git a/__tests__/main.test.ts b/__tests__/main.test.ts index d82074f..f44fd86 100644 --- a/__tests__/main.test.ts +++ b/__tests__/main.test.ts @@ -81,7 +81,7 @@ it('Should match generated changelog (unspecified fromTag)', async () => { it('Should match generated changelog (refs)', async () => { jest.setTimeout(180000) - const configuration = readConfiguration('configs/configuration_all_placeholders.json')!! + const configuration = readConfiguration('configs_test/configuration_all_placeholders.json')!! const releaseNotes = new ReleaseNotes({ owner: 'mikepenz', repo: 'release-changelog-builder-action', @@ -108,3 +108,39 @@ nhoelzl `) }) + +it('Should match ordered ASC', async () => { + jest.setTimeout(180000) + + const configuration = readConfiguration('configs_test/configuration_asc.json')!! + const releaseNotes = new ReleaseNotes({ + owner: 'mikepenz', + repo: 'release-changelog-builder-action', + fromTag: 'v0.3.0', + toTag: 'v0.5.0', + ignorePreReleases: false, + configuration: configuration + }) + + const changeLog = await releaseNotes.pull() + console.log(changeLog) + expect(changeLog).toStrictEqual(`## 🚀 Features\n\n22\n24\n25\n26\n28\n\n## 🐛 Fixes\n\n23\n\n`) +}) + +it('Should match ordered DESC', async () => { + jest.setTimeout(180000) + + const configuration = readConfiguration('configs_test/configuration_desc.json')!! + const releaseNotes = new ReleaseNotes({ + owner: 'mikepenz', + repo: 'release-changelog-builder-action', + fromTag: 'v0.3.0', + toTag: 'v0.5.0', + ignorePreReleases: false, + configuration: configuration + }) + + const changeLog = await releaseNotes.pull() + console.log(changeLog) + expect(changeLog).toStrictEqual(`## 🚀 Features\n\n28\n26\n25\n24\n22\n\n## 🐛 Fixes\n\n23\n\n`) +}) \ No newline at end of file diff --git a/configs/configuration_all_placeholders.json b/configs_test/configuration_all_placeholders.json similarity index 100% rename from configs/configuration_all_placeholders.json rename to configs_test/configuration_all_placeholders.json diff --git a/configs_test/configuration_asc.json b/configs_test/configuration_asc.json new file mode 100644 index 0000000..6e1fa39 --- /dev/null +++ b/configs_test/configuration_asc.json @@ -0,0 +1,4 @@ +{ + "sort": "ASC", + "pr_template": "${{NUMBER}}" +} \ No newline at end of file diff --git a/configs_test/configuration_desc.json b/configs_test/configuration_desc.json new file mode 100644 index 0000000..8d81997 --- /dev/null +++ b/configs_test/configuration_desc.json @@ -0,0 +1,4 @@ +{ + "sort": "DESC", + "pr_template": "${{NUMBER}}" +} \ No newline at end of file