7ca73f5871
Co-authored-by: Cursor <cursoragent@cursor.com>
35 lines
1.2 KiB
JavaScript
35 lines
1.2 KiB
JavaScript
import assert from 'node:assert/strict';
|
|
import fs from 'node:fs';
|
|
import os from 'node:os';
|
|
import path from 'node:path';
|
|
import test from 'node:test';
|
|
|
|
import { writeLatestMacYml } from './macYml.mjs';
|
|
import { progressFromLogLine } from './pipeline.mjs';
|
|
|
|
void test('progressFromLogLine maps release script milestones', () => {
|
|
assert.equal(progressFromLogLine('>>> Phase 2/2: Publish to server'), 68);
|
|
assert.equal(progressFromLogLine('=== Full release completed ==='), 100);
|
|
assert.equal(progressFromLogLine('random log line'), null);
|
|
});
|
|
|
|
void test('writeLatestMacYml writes version and hashes', () => {
|
|
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'ttrpg-pub-'));
|
|
try {
|
|
for (const name of [
|
|
'TTRPGPlayer-x64.zip',
|
|
'TTRPGPlayer-arm64.zip',
|
|
'TTRPGPlayer-x64.dmg',
|
|
'TTRPGPlayer-arm64.dmg',
|
|
]) {
|
|
fs.writeFileSync(path.join(dir, name), `fake-${name}`);
|
|
}
|
|
writeLatestMacYml(dir, '9.9.9');
|
|
const yml = fs.readFileSync(path.join(dir, 'latest-mac.yml'), 'utf8');
|
|
assert.match(yml, /^version: 9\.9\.9/m);
|
|
assert.match(yml, /path: TTRPGPlayer-x64\.zip/);
|
|
} finally {
|
|
fs.rmSync(dir, { recursive: true, force: true });
|
|
}
|
|
});
|