halkyon/test/release/targets_test.dart
Tizian 「ティツィアーン」 f06fc23023
All checks were successful
CI / check (push) Successful in 41m7s
CI / deploy (push) Successful in 1m2s
build(release): several apps released in one run (train:minor learn), their version commits pushed without the checks
The release tool and tool/with_signing_keys.sh take several apps, each with its version
after a colon or none, and release them one after another, each as alone, stopping at
the first that fails; the key script fetches every named app's key.

The pre-push hook skips tool/check.dart when a push brings release commits alone: the
release tool's chore(release) subject, an app's pubspec changed in its version line and
its texts of what's new, nothing else (tool/release_push.dart). Signatures are checked as
before, and CI still runs the checks. A release no longer costs a run of the checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
2026-11-03 12:16:10 +01:00

47 lines
1.4 KiB
Dart

import 'package:test/test.dart';
import '../../tool/src/release/targets.dart';
import '../../tool/src/release/version.dart';
void main() {
const apps = {'learn', 'todo', 'train'};
test('one app, as before, with or without the version asked for', () {
expect(parseTargets(['learn'], apps), [const ReleaseTarget('learn')]);
expect(parseTargets(['train', 'minor'], apps), [
const ReleaseTarget('train', Bump.minor),
]);
});
test('several apps, one after another in the order named, each with its '
'own version asked for after a colon or not at all', () {
expect(parseTargets(['train:minor', 'learn'], apps), [
const ReleaseTarget('train', Bump.minor),
const ReleaseTarget('learn'),
]);
expect(parseTargets(['learn', 'train', 'patch'], apps), [
const ReleaseTarget('learn'),
const ReleaseTarget('train', Bump.patch),
]);
});
test('refuses no app, an unknown one, one named twice, a version without '
'its app or asked for twice, and an unknown version', () {
for (final words in [
<String>[],
['meditate'],
['learn', 'learn:minor'],
['minor'],
['learn:minor', 'patch'],
['learn', 'minor', 'patch'],
['learn:huge'],
['learn:'],
]) {
expect(
() => parseTargets(words, apps),
throwsFormatException,
reason: '$words',
);
}
});
}