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
|
|
|
/// <reference types="vite/client" />
|
|
|
|
|
|
|
|
|
|
import { describe, it, expect } from 'vitest'
|
|
|
|
|
|
|
|
|
|
import { getApiUrl, getAppName, isDevelopment, isProduction, getEnv } from './env'
|
|
|
|
|
|
|
|
|
|
describe('Environment Utilities', () => {
|
|
|
|
|
describe('getApiUrl', () => {
|
|
|
|
|
it('should return API URL from environment or fallback to default', () => {
|
|
|
|
|
const url = getApiUrl()
|
2025-12-30 01:35:28 -08:00
|
|
|
// URL should be valid and contain localhost:4002 (default API port)
|
|
|
|
|
expect(url).toMatch(/^https?:\/\/localhost:4002/)
|
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
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
describe('getAppName', () => {
|
|
|
|
|
it('should return app name from environment or fallback to "unknown"', () => {
|
|
|
|
|
const appName = getAppName()
|
|
|
|
|
expect(appName).toBe('unknown')
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
describe('isDevelopment', () => {
|
|
|
|
|
it('should detect development mode correctly', () => {
|
|
|
|
|
const isDev = isDevelopment()
|
|
|
|
|
// In test environment, this will vary based on NODE_ENV
|
|
|
|
|
expect(typeof isDev).toBe('boolean')
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
describe('isProduction', () => {
|
|
|
|
|
it('should detect production mode correctly', () => {
|
|
|
|
|
const isProd = isProduction()
|
|
|
|
|
// In test environment, this will vary based on NODE_ENV
|
|
|
|
|
expect(typeof isProd).toBe('boolean')
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('should be opposite of isDevelopment in most cases', () => {
|
|
|
|
|
const isDev = isDevelopment()
|
|
|
|
|
const isProd = isProduction()
|
|
|
|
|
// They should not both be true
|
|
|
|
|
expect(isDev && isProd).toBe(false)
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
describe('getEnv', () => {
|
|
|
|
|
it('should retrieve environment variable or return undefined', () => {
|
|
|
|
|
const value = getEnv('NONEXISTENT_VAR')
|
|
|
|
|
expect(value).toBeUndefined()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('should use fallback when variable does not exist', () => {
|
|
|
|
|
const value = getEnv('NONEXISTENT_VAR', 'fallback')
|
|
|
|
|
expect(value).toBe('fallback')
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('should retrieve NODE_ENV if it exists', () => {
|
|
|
|
|
const value = getEnv('NODE_ENV')
|
|
|
|
|
// NODE_ENV should be set in test environment
|
|
|
|
|
expect(typeof value).toBe('string')
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
describe('Cross-environment compatibility', () => {
|
|
|
|
|
it('should handle Vite environment gracefully', () => {
|
|
|
|
|
// If import.meta.env exists, these functions should work
|
|
|
|
|
expect(() => getApiUrl()).not.toThrow()
|
|
|
|
|
expect(() => getAppName()).not.toThrow()
|
|
|
|
|
expect(() => isDevelopment()).not.toThrow()
|
|
|
|
|
expect(() => isProduction()).not.toThrow()
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
it('should handle Node.js environment gracefully', () => {
|
|
|
|
|
// Even if process.env doesn't have values, should not throw
|
|
|
|
|
expect(() => getEnv('ANY_VAR')).not.toThrow()
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
})
|