testflight: description keys by language id or App Store locale, unknown keys are a config error, primary-locale check before Beta App Review

This commit is contained in:
CRTkafa 2026-10-29 22:33:59 +07:00
parent e185b61c8e
commit 1abd0936c3
6 changed files with 35 additions and 3 deletions

View file

@ -15,6 +15,7 @@ const UPLOAD_HOST = 'https://upload.example.com/';
/** list relationship -> resource type of its items (parent type / relationship name); `one` for to-one relationships. */
const LISTS: Record<string, { type: string; one?: boolean }> = {
'apps/betaAppLocalizations': { type: 'betaAppLocalizations' },
'apps/inAppPurchasesV2': { type: 'inAppPurchases' },
'inAppPurchases/inAppPurchaseLocalizations': { type: 'inAppPurchaseLocalizations' },
'inAppPurchases/iapPriceSchedule': { type: 'inAppPurchasePriceSchedules', one: true },

View file

@ -0,0 +1,14 @@
import { expect, test } from 'bun:test';
import { betaDescriptions, validateTestflight } from '../cli/lib/testflight';
const langs = [{ id: 'en', apple: 'en-US' }, { id: 'tr', apple: 'tr' }];
test('beta descriptions take a language id or its App Store locale ("en-US" was skipped silently)', () => {
expect(betaDescriptions({ description: { 'en-US': 'Hello', tr: 'Merhaba' } }, langs)).toEqual({ 'en-US': 'Hello', tr: 'Merhaba' });
expect(betaDescriptions({ description: { en: 'Hello' } }, langs)).toEqual({ 'en-US': 'Hello' });
});
test('an unknown description key is a config error naming the accepted keys', () => {
expect(validateTestflight({ description: { 'en-US': 'x', de: 'y' } }, langs).join()).toContain("'de' is not a language of the config");
expect(validateTestflight({ description: { 'en-US': 'x', tr: 'y' } }, langs)).toEqual([]);
});