storebound/tests/tf-description-locale.test.ts

14 lines
861 B
TypeScript

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([]);
});