upload --pre-check/--evidence, shots copy translate, game-center --locale-map, play games API-disabled hint

This commit is contained in:
CRTkafa 2026-10-24 12:10:23 +08:00
parent 29a9683ab7
commit 8ffa27d4f8
24 changed files with 598 additions and 27 deletions

View file

@ -287,6 +287,34 @@ describe('idempotent re-upload (fake stores)', () => {
expect(JSON.parse(r.out)).toMatchObject({ ok: true, step: 'upload', store: 'apple', version: '1.2.0', build: '7', state: 'VALID' });
expect(writes(s.calls).filter(c => /buildUploads/.test(c.path))).toEqual([]);
});
test('play upload --pre-check: a passing command writes the evidence and joins the result; a failing one refuses with PRE_CHECK_FAILED before any write', async () => {
const d = tmp();
const p = project(BASE, { 'store/listing.md': LISTING, 'build/android/app.aab': makeAab('com.example.notes', 42, '1.2.0') });
const ev = join(d, 'ev', 'evidence.json');
const bad = await ship('play upload', ['--json', '--yes', '--pre-check', 'echo scanning {file}; exit 3', '--evidence', ev], a => playUpload({ loaded: p.loaded, args: a }));
expect(bad.code).toBe(1);
const jb = JSON.parse(bad.out);
expect(jb).toMatchObject({ ok: false, error: { code: 'PRE_CHECK_FAILED' }, preCheck: { exitCode: 3, size: expect.any(Number) } });
expect(JSON.parse(readFileSync(ev, 'utf8')).exitCode).toBe(3);
expect(writes(s.calls)).toEqual([]);
const ok = await ship('play upload', ['--json', '--yes', '--pre-check', 'echo scanning {file}', '--evidence', ev], a => playUpload({ loaded: p.loaded, args: a }));
expect(ok.code).toBe(0);
const e = JSON.parse(readFileSync(ev, 'utf8'));
expect(e).toMatchObject({ file: 'build/android/app.aab', exitCode: 0, storeboundVersion: expect.any(String) });
expect(e.sha256).toMatch(/^[0-9a-f]{64}$/);
expect(e.stdoutTail.join(' ')).toContain('scanning');
expect(JSON.parse(ok.out).preCheck.sha256).toBe(e.sha256);
});
test('apple upload --pre-check: a failing command stops before any App Store Connect call', async () => {
const plist = '<?xml version="1.0" encoding="UTF-8"?><plist version="1.0"><dict><key>CFBundleIdentifier</key><string>com.example.notes</string><key>CFBundleShortVersionString</key><string>1.2.0</string><key>CFBundleVersion</key><string>9</string></dict></plist>';
const p = project(BASE, { 'build/ios/export/Example.ipa': makeIpa(plist) });
const n = s.calls.length;
const r = await ship('apple upload', ['--json', '--yes', '--pre-check', 'exit 1'], a => appleUpload({ loaded: p.loaded, args: a }));
expect(r.code).toBe(1);
expect(JSON.parse(r.out)).toMatchObject({ ok: false, step: 'upload', store: 'apple', error: { code: 'PRE_CHECK_FAILED' }, preCheck: { exitCode: 1 } });
expect(s.calls.length).toBe(n);
});
});
describe('status', () => {