- introduce tests to verify new placeholders used for template and empty_template
This commit is contained in:
@@ -1,19 +1,6 @@
|
|||||||
import { resolveConfiguration } from '../src/utils';
|
import { resolveConfiguration } from '../src/utils';
|
||||||
import { ReleaseNotesBuilder } from '../src/releaseNotesBuilder';
|
import { ReleaseNotesBuilder } from '../src/releaseNotesBuilder';
|
||||||
|
|
||||||
// shows how the runner will run a javascript action with env / stdout protocol
|
|
||||||
/*
|
|
||||||
test('test runs', () => {
|
|
||||||
jest.setTimeout(180000);
|
|
||||||
|
|
||||||
process.env['INPUT_CONFIGURATION'] = 'configuration.json'
|
|
||||||
const ip = path.join(__dirname, '..', 'lib', 'main.js')
|
|
||||||
const options: cp.ExecSyncOptions = {
|
|
||||||
env: process.env
|
|
||||||
}
|
|
||||||
console.log(cp.execSync(`node ${ip}`, options).toString())
|
|
||||||
})
|
|
||||||
*/
|
|
||||||
it('Should match generated changelog (unspecified fromTag)', async () => {
|
it('Should match generated changelog (unspecified fromTag)', async () => {
|
||||||
jest.setTimeout(180000)
|
jest.setTimeout(180000)
|
||||||
|
|
||||||
@@ -39,3 +26,66 @@ it('Should match generated changelog (unspecified fromTag)', async () => {
|
|||||||
|
|
||||||
`)
|
`)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('Should use empty placeholder', async () => {
|
||||||
|
jest.setTimeout(180000)
|
||||||
|
|
||||||
|
const configuration = resolveConfiguration('', 'configs/configuration.json')
|
||||||
|
const releaseNotesBuilder = new ReleaseNotesBuilder(
|
||||||
|
null,
|
||||||
|
'.',
|
||||||
|
'mikepenz',
|
||||||
|
'release-changelog-builder-action',
|
||||||
|
'v0.0.2',
|
||||||
|
'v0.0.3',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
configuration
|
||||||
|
)
|
||||||
|
|
||||||
|
const changeLog = await releaseNotesBuilder.build()
|
||||||
|
console.log(changeLog)
|
||||||
|
expect(changeLog).toStrictEqual(`- no changes`)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Should fill empty placeholders', async () => {
|
||||||
|
jest.setTimeout(180000)
|
||||||
|
|
||||||
|
const configuration = resolveConfiguration('', 'configs_test/configuration_empty_all_placeholders.json')
|
||||||
|
const releaseNotesBuilder = new ReleaseNotesBuilder(
|
||||||
|
null,
|
||||||
|
'.',
|
||||||
|
'mikepenz',
|
||||||
|
'release-changelog-builder-action',
|
||||||
|
'v0.0.2',
|
||||||
|
'v0.0.3',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
configuration
|
||||||
|
)
|
||||||
|
|
||||||
|
const changeLog = await releaseNotesBuilder.build()
|
||||||
|
console.log(changeLog)
|
||||||
|
expect(changeLog).toStrictEqual(`mikepenz\nrelease-changelog-builder-action\nv0.0.2\nv0.0.3`)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Should fill `template` placeholders', async () => {
|
||||||
|
jest.setTimeout(180000)
|
||||||
|
|
||||||
|
const configuration = resolveConfiguration('', 'configs_test/configuration_empty_all_placeholders.json')
|
||||||
|
const releaseNotesBuilder = new ReleaseNotesBuilder(
|
||||||
|
null,
|
||||||
|
'.',
|
||||||
|
'mikepenz',
|
||||||
|
'release-changelog-builder-action',
|
||||||
|
'v0.0.1',
|
||||||
|
'v0.0.3',
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
configuration
|
||||||
|
)
|
||||||
|
|
||||||
|
const changeLog = await releaseNotesBuilder.build()
|
||||||
|
console.log(changeLog)
|
||||||
|
expect(changeLog).toStrictEqual(`## 🧪 Tests\n\n- [CI] Specify Test Case\n - PR: #10\n\n\n\nmikepenz\nrelease-changelog-builder-action\nv0.0.1\nv0.0.3\n1\n0`)
|
||||||
|
})
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"template": "${{CHANGELOG}}\n${{UNCATEGORIZED}}\n${{OWNER}}\n${{REPO}}\n${{FROM_TAG}}\n${{TO_TAG}}\n${{CATEGORIZED_COUNT}}\n${{UNCATEGORIZED_COUNT}}",
|
||||||
|
"empty_template": "${{OWNER}}\n${{REPO}}\n${{FROM_TAG}}\n${{TO_TAG}}"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user