| 1 | import { describe, expect, it } from 'vitest' |
| 2 | import { zh } from '../../../src/renderer/src/i18n/zh' |
| 3 | import { en } from '../../../src/renderer/src/i18n/en' |
| 4 | import type { AnimationPreferenceId } from '../../../src/shared/generation' |
| 5 | |
| 6 | const EXPECTED_IDS: AnimationPreferenceId[] = [ |
| 7 | 'fade', |
| 8 | 'fade-up', |
| 9 | 'fade-down', |
| 10 | 'fade-left', |
| 11 | 'fade-right', |
| 12 | 'scale-in', |
| 13 | 'slide-up', |
| 14 | 'slide-down', |
| 15 | 'slide-left', |
| 16 | 'slide-right', |
| 17 | 'fly-in', |
| 18 | 'wipe', |
| 19 | 'zoom-in', |
| 20 | 'spin-in', |
| 21 | 'pulse-soft', |
| 22 | 'pulse', |
| 23 | 'pulse-strong', |
| 24 | 'grow-shrink-soft', |
| 25 | 'grow-shrink', |
| 26 | 'grow-shrink-strong' |
| 27 | ] |
| 28 | |
| 29 | describe('animation preference option i18n', () => { |
| 30 | it('every preference id has a zh + en label', () => { |
| 31 | const zhOptions = zh.home.animationPreferenceOptions as Record<string, string> |
| 32 | const enOptions = en.home.animationPreferenceOptions as Record<string, string> |
| 33 | for (const id of EXPECTED_IDS) { |
| 34 | expect(zhOptions[id], `missing zh label for ${id}`).toBeTruthy() |
| 35 | expect(enOptions[id], `missing en label for ${id}`).toBeTruthy() |
| 36 | } |
| 37 | }) |
| 38 | |
| 39 | it('zh and en expose the same set of option keys', () => { |
| 40 | expect(Object.keys(zh.home.animationPreferenceOptions).sort()).toEqual( |
| 41 | Object.keys(en.home.animationPreferenceOptions).sort() |
| 42 | ) |
| 43 | }) |
| 44 | |
| 45 | it('has a limit-reached toast in both langs', () => { |
| 46 | expect(zh.home.animationPreferenceLimitReached).toBeTruthy() |
| 47 | expect(en.home.animationPreferenceLimitReached).toBeTruthy() |
| 48 | }) |
| 49 | }) |
| 50 |