This repository has been archived on 2026-09-30. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
ForgeFlow/tests/release-policy.test.mjs
T
NuklearRabbit 8769f07539
Managed validation / full (pull_request) Successful in 27s
ChatGPT validation / quality (push) Successful in 21m36s
release: bridge legacy installations to ForgeFlow-Public
2026-09-30 23:02:50 +02:00

22 lines
1.2 KiB
JavaScript

import test from 'node:test';
import assert from 'node:assert/strict';
import releasePolicy from '../src/shared/release-policy.cjs';
const { windowsReleaseAssetNames, existingReleaseState } = releasePolicy;
const commit = 'a'.repeat(40);
const version = '0.10.16';
test('a draft for another commit cannot receive replacement release assets', () => {
assert.throws(() => existingReleaseState({ target_commitish: 'b'.repeat(40), draft: true }, version, commit), /Bump the version/);
});
test('a matching draft can resume while a complete published release is immutable', () => {
assert.equal(existingReleaseState({ target_commitish: commit, draft: true }, version, commit), 'draft');
assert.equal(existingReleaseState({ target_commitish: commit, draft: false, assets: windowsReleaseAssetNames(version).map((name) => ({ name })) }, version, commit), 'published');
});
test('a published release missing its signature cannot be treated as complete', () => {
const assets = windowsReleaseAssetNames(version).filter((name) => !name.endsWith('.sig')).map((name) => ({ name }));
assert.throws(() => existingReleaseState({ target_commitish: commit, draft: false, assets }, version, commit), /release-manifest.json.sig/);
});