Files
callstack__agent-device/scripts/__tests__/prepare-publish-assets.test.ts
Michał Pierzchała b15121ffc8 test(ios): establish snapshot convergence baselines and permanent evidence (#2204)
* test(ios): add snapshot convergence evidence harness

* fix(ios): satisfy benchmark CI guards

* fix(ios): constrain benchmark proxy routes

* fix(ios-benchmark): enforce cell admission evidence

* fix(ios-benchmark): protect benchmark state ownership

* fix(ios-benchmark): use proxy port flag

* fix(ios-benchmark): let proxy choose an ephemeral port

* test(ios-benchmark): keep CLI process seam local

* fix(ios-benchmark): parse proxy startup envelope

* fix(ios-benchmark): bind proxy lease to simulator

* fix(ios-benchmark): keep fresh proxy CLI sessions isolated

* fix(ios-benchmark): preserve async timeout evidence

* docs(ios-benchmark): retain exact-head evidence

* test(ios): reveal offscreen alert fixture controls

* test(ios): reset alert between relaunch samples

* test(ios): admit native alert snapshots

* docs(ios): publish snapshot convergence corpus

* chore(ios): format benchmark evidence

* fix(ios-benchmark): admit proxy fixture anchors

* docs(ios): republish exact-head benchmark corpus

* fix(size): make publish asset evidence hermetic

* style(size): format package evidence test

* test(size): update publish preparation contracts

* fix: retire stale utils layering zone

* test: pin shared publish asset owner

* test: verify preserved size reporter closure

* fix: move mutation ownership to snapshot module

* test(ios): add snapshot convergence evidence harness

* fix(ios): satisfy benchmark CI guards

* fix(ios): constrain benchmark proxy routes

* fix(ios-benchmark): enforce cell admission evidence

* fix(ios-benchmark): protect benchmark state ownership

* fix(ios-benchmark): use proxy port flag

* fix(ios-benchmark): let proxy choose an ephemeral port

* test(ios-benchmark): keep CLI process seam local

* fix(ios-benchmark): parse proxy startup envelope

* fix(ios-benchmark): bind proxy lease to simulator

* fix(ios-benchmark): keep fresh proxy CLI sessions isolated

* fix(ios-benchmark): preserve async timeout evidence

* docs(ios-benchmark): retain exact-head evidence

* test(ios): reveal offscreen alert fixture controls

* test(ios): reset alert between relaunch samples

* test(ios): admit native alert snapshots

* docs(ios): publish snapshot convergence corpus

* chore(ios): format benchmark evidence

* fix(ios-benchmark): admit proxy fixture anchors

* docs(ios): republish exact-head benchmark corpus

* fix(size): make publish asset evidence hermetic

* test(size): update publish preparation contracts

* fix: keep git-state gates out of mutation sandboxes
2026-09-01 21:39:05 +02:00

48 lines
1.7 KiB
TypeScript

import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';
import { test } from 'vitest';
import { mkdtempForTestSync } from '../../src/__tests__/test-utils/tmp-dir.ts';
import { preparePublishAssets } from '../prepare-publish-assets.mjs';
test('prepares both Android runtime helpers through the shared publish owner', () => {
const root = mkdtempForTestSync('agent-device-publish-assets-');
const scriptsDirectory = path.join(root, 'scripts');
fs.mkdirSync(scriptsDirectory, { recursive: true });
fs.writeFileSync(path.join(root, 'package.json'), '{"version":"1.2.3"}\n');
fs.writeFileSync(path.join(scriptsDirectory, 'package-apple-runner-source.mjs'), '');
fs.writeFileSync(
path.join(scriptsDirectory, 'package-android-helper.sh'),
`#!/bin/sh
set -eu
if [ "$AGENT_DEVICE_ANDROID_HELPER" = "snapshot" ]; then
output="$3"
else
output="$2"
fi
mkdir -p "$output"
prefix="agent-device-android-$AGENT_DEVICE_ANDROID_HELPER-helper-$1"
printf apk > "$output/$prefix.apk"
printf manifest > "$output/$prefix.manifest.json"
printf checksum > "$output/$prefix.apk.sha256"
`,
);
const stalePath = path.join(root, 'android', 'ime-helper', 'dist', 'stale.apk');
fs.mkdirSync(path.dirname(stalePath), { recursive: true });
fs.writeFileSync(stalePath, 'stale');
preparePublishAssets({ root });
assert.equal(fs.existsSync(stalePath), false);
for (const helper of ['snapshot', 'ime']) {
const prefix = `agent-device-android-${helper}-helper-1.2.3`;
const directory = path.join(root, 'android', `${helper}-helper`, 'dist');
assert.deepEqual(fs.readdirSync(directory).sort(), [
`${prefix}.apk`,
`${prefix}.apk.sha256`,
`${prefix}.manifest.json`,
]);
}
});