import { afterEach, describe, expect, it, vi } from 'vitest'; import { matchAppRoute } from './appRoutes'; afterEach(() => { vi.unstubAllEnvs(); }); describe('matchAppRoute', () => { it('routes the main app by default', () => { expect(matchAppRoute('/')).toEqual({ kind: 'game', }); }); it('routes puzzle playground path to the standalone puzzle runtime', () => { expect(matchAppRoute('/puzzle')).toEqual({ kind: 'puzzle-playground', }); }); it('routes big fish playground path to the standalone big fish runtime', () => { expect(matchAppRoute('/BIG-FISH/')).toEqual({ kind: 'big-fish-playground', }); }); it('routes match3d playground path to the standalone Match3D runtime', () => { expect(matchAppRoute('/MATCH3D/')).toEqual({ kind: 'match3d-playground', }); }); it('routes child motion demo path to the standalone warmup demo', () => { expect(matchAppRoute('/CHILD-MOTION-DEMO/')).toEqual({ kind: 'child-motion-demo', }); }); it('blocks direct child motion demo path when edutainment entry is disabled', () => { vi.stubEnv('VITE_ENABLE_EDUTAINMENT_ENTRY', 'false'); expect(matchAppRoute('/child-motion-demo')).toEqual({ kind: 'game', }); }); it('routes baby love drawing path to the standalone runtime when edutainment is enabled', () => { expect(matchAppRoute('/runtime/baby-love-drawing')).toEqual({ kind: 'baby-love-drawing', }); }); it('blocks direct baby love drawing path when edutainment entry is disabled', () => { vi.stubEnv('VITE_ENABLE_EDUTAINMENT_ENTRY', 'false'); expect(matchAppRoute('/runtime/baby-love-drawing')).toEqual({ kind: 'game', }); }); it('routes former standalone editor paths back to the main game', () => { expect(matchAppRoute('/item-editor/tools')).toEqual({ kind: 'game', }); expect(matchAppRoute('/behavior-editor')).toEqual({ kind: 'game', }); expect(matchAppRoute('/NPC-EDITOR/profiles/')).toEqual({ kind: 'game', }); }); it('routes independent page paths to the main app shell', () => { expect(matchAppRoute('/creation/rpg/agent')).toEqual({ kind: 'game', }); expect(matchAppRoute('/runtime/puzzle')).toEqual({ kind: 'game', }); expect(matchAppRoute('/runtime/big-fish')).toEqual({ kind: 'game', }); }); it('does not treat unrelated prefixes as preset editor routes', () => { expect(matchAppRoute('/npc-editorial')).toEqual({ kind: 'game', }); }); });