apple listing: a new version inherits the previous version's release type when apple.releaseType is unset; warn when the config differs

This commit is contained in:
CRTkafa 2026-10-29 19:59:49 +07:00
parent f5296cc9e9
commit 6ebb656018
5 changed files with 31 additions and 3 deletions

View file

@ -101,7 +101,7 @@ describe('apple listing plan', () => {
const p = project({ ...BASE, play: undefined }, { 'store/appstore.md': APPLE_MD });
const calls = ascRoutes([v('v-0', '1.0.0', 'READY_FOR_DISTRIBUTION')]);
const j = jsonOut((await capture(() => appleListing(p.ctx(['--version', '1.1.0', '--dry', '--json'])))).out) as any;
expect(j.versionPlan).toMatchObject({ action: 'create', reason: 'create version 1.1.0 (no editable iOS version)' });
expect(j.versionPlan).toMatchObject({ action: 'create', reason: expect.stringContaining('create version 1.1.0 (no editable iOS version), release type MANUAL') });
expect(j.versionLocales).toBeNull();
await capture(() => appleListing(p.ctx(['--version', '1.1.0'])));
expect(methods(calls).filter(m => m.includes('appStoreVersion'))).toEqual(['POST /v1/appStoreVersions', 'POST /v1/appStoreVersionLocalizations']);

View file

@ -0,0 +1,16 @@
import { expect, test } from 'bun:test';
import { planVersion } from '../cli/lib/listing-plan';
const row = (id: string, versionString: string, state: string, releaseType: string) => ({ id, attributes: { versionString, appStoreState: state, appVersionState: state, platform: 'IOS', releaseType } });
test('a new version keeps the release type of the newest version before it unless apple.releaseType is set', () => {
const rows = [row('v1', '2.0.0', 'READY_FOR_DISTRIBUTION', 'MANUAL'), row('v2', '2.0.1', 'READY_FOR_DISTRIBUTION', 'AFTER_APPROVAL')];
const p = planVersion(rows, '2.0.2', { copyright: 'c' }, 'IOS');
expect(p.action).toBe('create');
expect(p.attributes.releaseType).toBe('AFTER_APPROVAL');
expect(p.reason).toContain('as version 2.0.1');
const set = planVersion(rows, '2.0.2', { copyright: 'c', releaseType: 'MANUAL' }, 'IOS');
expect(set.attributes.releaseType).toBe('MANUAL');
expect(set.warning).toContain('differs from version 2.0.1 (AFTER_APPROVAL)');
expect(planVersion([], '1.0.0', { copyright: 'c' }, 'IOS').attributes.releaseType).toBe('MANUAL');
});