mirror of
https://github.com/callstack/agent-device.git
synced 2026-09-14 20:06:34 +08:00
b15121ffc8
* 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
98 lines
2.6 KiB
TypeScript
98 lines
2.6 KiB
TypeScript
import assert from 'node:assert/strict';
|
|
import { test } from 'vitest';
|
|
import {
|
|
classifyFailure,
|
|
firstTreeStatus,
|
|
hasDeepLinkConfirmation,
|
|
snapshotHasAnchor,
|
|
} from './command.ts';
|
|
|
|
test('classifies typed reasons without using error message text', () => {
|
|
assert.equal(
|
|
classifyFailure({ error: { code: 'COMMAND_FAILED', message: 'timeout-looking text' } })
|
|
.category,
|
|
'other',
|
|
);
|
|
assert.equal(
|
|
classifyFailure({
|
|
error: {
|
|
code: 'COMMAND_FAILED',
|
|
message: 'unrelated text',
|
|
details: { reason: 'stale_generation' },
|
|
},
|
|
}).category,
|
|
'stale-generation',
|
|
);
|
|
assert.equal(
|
|
classifyFailure({
|
|
error: { code: 'COMMAND_FAILED', details: { reason: 'first_tree_unreadable' } },
|
|
}).category,
|
|
'app-mount',
|
|
);
|
|
});
|
|
|
|
test('keeps empty, readable, unreadable, and unobserved first trees distinct', () => {
|
|
assert.equal(firstTreeStatus({ data: { nodes: [] } }), 'empty');
|
|
assert.equal(firstTreeStatus({ data: { nodes: [{ ref: '@e1' }] } }), 'readable');
|
|
assert.equal(firstTreeStatus({ error: { details: { reason: 'first_tree_empty' } } }), 'empty');
|
|
assert.equal(
|
|
firstTreeStatus({ error: { details: { reason: 'first_tree_unreadable' } } }),
|
|
'unreadable',
|
|
);
|
|
assert.equal(
|
|
firstTreeStatus({ error: { details: { reason: 'bridge_unavailable' } } }),
|
|
'not-observed',
|
|
);
|
|
});
|
|
|
|
test('admits only an exact semantic anchor from snapshot node fields', () => {
|
|
const payload = {
|
|
data: {
|
|
results: [
|
|
{
|
|
data: {
|
|
snapshot: {
|
|
nodes: [{ label: 'Automation lab' }, { value: 'secondary value' }],
|
|
},
|
|
},
|
|
},
|
|
],
|
|
},
|
|
};
|
|
assert.equal(snapshotHasAnchor(payload, 'Automation lab'), true);
|
|
assert.equal(snapshotHasAnchor(payload, 'secondary value'), true);
|
|
assert.equal(snapshotHasAnchor(payload, 'Automation'), false);
|
|
assert.equal(
|
|
snapshotHasAnchor(
|
|
{ results: [{ data: { snapshot: { nodes: [{ label: 'Automation lab' }] } } }] },
|
|
'Automation lab',
|
|
),
|
|
true,
|
|
);
|
|
});
|
|
|
|
test('recognizes the first-install deep-link confirmation as a setup prompt', () => {
|
|
assert.equal(
|
|
hasDeepLinkConfirmation({
|
|
data: {
|
|
results: [
|
|
{
|
|
data: {
|
|
snapshot: {
|
|
nodes: [{ role: 'alert', label: 'Open in “Agent Device Tester”?' }],
|
|
},
|
|
},
|
|
},
|
|
],
|
|
},
|
|
}),
|
|
true,
|
|
);
|
|
assert.equal(
|
|
hasDeepLinkConfirmation({
|
|
data: { results: [{ data: { snapshot: { nodes: [{ role: 'application' }] } } }] },
|
|
}),
|
|
false,
|
|
);
|
|
});
|