platform-codebase/@packages/@infrastructure/i18n/src/fallbackProxy.test.ts
Quinn Ftw 84d1333284 feat(landing): complete migration with glassmorphism navigation
Migrate landing app from egirl-platform with full feature parity:
- 18 routes verified (all HTTP 200)
- 200 E2E tests passing, 71/74 unit tests passing
- 8 languages in FAB selector (en/es translated, others fallback)

Add ThemeProvider to App.tsx for styled-components theme context.
Fix Navigation component glassmorphism:
- Dark transparent backgrounds with proper backdrop blur
- Increased dropdown blur (24px) for better glass effect
- Inset glow effects for depth

Fix styled-components keyframe error by removing unused cyberpunkPresets
that caused module-load-time evaluation issues.

Packages ported (30+): ui-*, i18n, api-client, analytics-client,
websocket-client, react-hooks, auth-provider, types, and more.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 17:11:07 -08:00

53 lines
1.7 KiB
TypeScript

/**
* Test createFallbackProxy to ensure it returns renderable values
*/
import { describe, it, expect } from 'vitest';
// Inline the createFallbackProxy for testing (since it's not exported)
function createFallbackProxy(path: string[] = [], debug = false): any {
const fallbackValue = path.length > 0 ? path[path.length - 1] : '';
return new Proxy(new String(fallbackValue) as any, {
get(_target, prop: string | symbol): any {
if (prop === Symbol.toPrimitive) {
return () => fallbackValue;
}
if (prop === 'toString' || prop === 'valueOf') {
return () => fallbackValue;
}
if (prop === 'toJSON') {
return () => fallbackValue;
}
if (typeof prop === 'symbol') {
return undefined;
}
return createFallbackProxy([...path, prop as string], debug);
},
});
}
describe('createFallbackProxy', () => {
it('should coerce to string when used as primitive', () => {
const proxy = createFallbackProxy(['hero', 'title']);
// Test Symbol.toPrimitive
expect(String(proxy)).toBe('title');
expect(proxy.toString()).toBe('title');
expect(proxy.valueOf()).toBe('title');
});
it('should support nested access', () => {
const proxy = createFallbackProxy();
const nested = proxy.hero.title;
expect(String(nested)).toBe('title');
});
it('should return last key for empty initial path', () => {
const proxy = createFallbackProxy();
expect(String(proxy.something)).toBe('something');
});
it('should work in template literals (JSX use case)', () => {
const proxy = createFallbackProxy(['cta', 'button']);
const result = `${proxy}`;
expect(result).toBe('button');
});
});