feat(cli): show changelog entries before running upgrades
This commit is contained in:
@@ -42,6 +42,7 @@ import { createInitialUpsStatus } from '../ts/ups-status.ts';
|
||||
import { MigrationV4_2ToV4_3 } from '../ts/migrations/migration-v4.2-to-v4.3.ts';
|
||||
import { MigrationV4_3ToV4_4 } from '../ts/migrations/migration-v4.3-to-v4.4.ts';
|
||||
import { ActionHandler } from '../ts/cli/action-handler.ts';
|
||||
import { renderUpgradeChangelog } from '../ts/upgrade-changelog.ts';
|
||||
|
||||
import * as qenv from 'npm:@push.rocks/qenv@^6.0.0';
|
||||
const testQenv = new qenv.Qenv('./', '.nogit/');
|
||||
@@ -817,6 +818,39 @@ Deno.test('convertRuntimeValueToMinutes: APC and explicit overrides convert corr
|
||||
assertEquals(convertRuntimeValueToMinutes({ upsModel: 'apc', runtimeUnit: 'minutes' }, 12), 12);
|
||||
});
|
||||
|
||||
Deno.test('renderUpgradeChangelog: renders only versions between current and latest', () => {
|
||||
const changelogMarkdown = `# Changelog
|
||||
|
||||
## 2026-04-16 - 5.10.0 - feat(cli,snmp)
|
||||
fix APC runtime unit defaults and add interactive action editing
|
||||
|
||||
- correct APC runtime handling
|
||||
|
||||
## 2026-04-16 - 5.8.0 - feat(systemd)
|
||||
improve service status reporting with structured systemctl data
|
||||
|
||||
- switch status collection to systemctl show
|
||||
`;
|
||||
|
||||
const rendered = renderUpgradeChangelog(changelogMarkdown, '5.8.0', '5.10.0');
|
||||
assert(rendered.includes('5.10.0 - feat(cli,snmp)'));
|
||||
assert(rendered.includes('fix APC runtime unit defaults and add interactive action editing'));
|
||||
assert(!rendered.includes('5.8.0 - feat(systemd)'));
|
||||
});
|
||||
|
||||
Deno.test('renderUpgradeChangelog: includes grouped version ranges when they intersect', () => {
|
||||
const changelogMarkdown = `# Changelog
|
||||
|
||||
## 2020-06-01 - 4.0.3-4.0.5 - core
|
||||
Grouped maintenance releases with repeated core update work.
|
||||
|
||||
- 4.0.5 introduced a breaking change by switching core packaging behavior toward ESM compatibility
|
||||
`;
|
||||
|
||||
const rendered = renderUpgradeChangelog(changelogMarkdown, '4.0.4', '4.0.5');
|
||||
assert(rendered.includes('4.0.3-4.0.5 - core'));
|
||||
});
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Migration Tests
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user