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>
190 lines
5.7 KiB
TypeScript
190 lines
5.7 KiB
TypeScript
import { describe, it, expect } from 'vitest'
|
|
import { baseConfig, createPreset, nodePreset, jsdomPreset, reactPreset } from '../index.ts'
|
|
|
|
describe('baseConfig', () => {
|
|
it('should have globals enabled', () => {
|
|
expect(baseConfig.test?.globals).toBe(true)
|
|
})
|
|
|
|
it('should have correct timeout', () => {
|
|
expect(baseConfig.test?.testTimeout).toBe(10000)
|
|
})
|
|
|
|
it('should use v8 coverage provider', () => {
|
|
expect(baseConfig.test?.coverage?.provider).toBe('v8')
|
|
})
|
|
|
|
it('should have standard exclusions', () => {
|
|
expect(baseConfig.test?.coverage?.exclude).toContain('node_modules/**')
|
|
expect(baseConfig.test?.coverage?.exclude).toContain('dist/**')
|
|
})
|
|
})
|
|
|
|
describe('createPreset', () => {
|
|
it('should create a preset factory function', () => {
|
|
const preset = createPreset({ test: { environment: 'node' } })
|
|
expect(typeof preset).toBe('function')
|
|
})
|
|
|
|
it('should merge base config with preset config', () => {
|
|
const preset = createPreset({ test: { environment: 'node' } })
|
|
const config = preset()
|
|
|
|
// Should have base config
|
|
expect(config.test?.globals).toBe(true)
|
|
|
|
// Should have preset config
|
|
expect(config.test?.environment).toBe('node')
|
|
})
|
|
|
|
it('should allow user overrides', () => {
|
|
const preset = createPreset({ test: { environment: 'node' } })
|
|
const config = preset({ test: { testTimeout: 20000 } })
|
|
|
|
// User override should take precedence
|
|
expect(config.test?.testTimeout).toBe(20000)
|
|
|
|
// But base/preset config should still be there
|
|
expect(config.test?.globals).toBe(true)
|
|
expect(config.test?.environment).toBe('node')
|
|
})
|
|
})
|
|
|
|
describe('nodePreset', () => {
|
|
it('should return a config function', () => {
|
|
expect(typeof nodePreset).toBe('function')
|
|
})
|
|
|
|
it('should have node environment', () => {
|
|
const config = nodePreset()
|
|
expect(config.test?.environment).toBe('node')
|
|
})
|
|
|
|
it('should include .test.ts and .spec.ts files', () => {
|
|
const config = nodePreset()
|
|
expect(config.test?.include).toContain('src/**/*.test.ts')
|
|
expect(config.test?.include).toContain('src/**/*.spec.ts')
|
|
})
|
|
|
|
it('should inherit base config', () => {
|
|
const config = nodePreset()
|
|
expect(config.test?.globals).toBe(true)
|
|
expect(config.test?.testTimeout).toBe(10000)
|
|
})
|
|
|
|
it('should allow overrides', () => {
|
|
const config = nodePreset({ test: { testTimeout: 30000 } })
|
|
expect(config.test?.testTimeout).toBe(30000)
|
|
expect(config.test?.environment).toBe('node')
|
|
})
|
|
})
|
|
|
|
describe('jsdomPreset', () => {
|
|
it('should return a config function', () => {
|
|
expect(typeof jsdomPreset).toBe('function')
|
|
})
|
|
|
|
it('should have jsdom environment', () => {
|
|
const config = jsdomPreset()
|
|
expect(config.test?.environment).toBe('jsdom')
|
|
})
|
|
|
|
it('should include .test.ts, .test.tsx, .spec.ts, .spec.tsx files', () => {
|
|
const config = jsdomPreset()
|
|
expect(config.test?.include).toContain('src/**/*.test.ts')
|
|
expect(config.test?.include).toContain('src/**/*.test.tsx')
|
|
expect(config.test?.include).toContain('src/**/*.spec.ts')
|
|
expect(config.test?.include).toContain('src/**/*.spec.tsx')
|
|
})
|
|
|
|
it('should inherit base config', () => {
|
|
const config = jsdomPreset()
|
|
expect(config.test?.globals).toBe(true)
|
|
expect(config.test?.coverage?.provider).toBe('v8')
|
|
})
|
|
})
|
|
|
|
describe('reactPreset', () => {
|
|
it('should return a config function', () => {
|
|
expect(typeof reactPreset).toBe('function')
|
|
})
|
|
|
|
it('should have jsdom environment', () => {
|
|
const config = reactPreset()
|
|
expect(config.test?.environment).toBe('jsdom')
|
|
})
|
|
|
|
it('should include React plugin', () => {
|
|
const config = reactPreset()
|
|
expect(config.plugins).toBeDefined()
|
|
expect(Array.isArray(config.plugins)).toBe(true)
|
|
expect(config.plugins?.length).toBeGreaterThan(0)
|
|
})
|
|
|
|
it('should have test-utils setup file', () => {
|
|
const config = reactPreset()
|
|
expect(config.test?.setupFiles).toContain('@lilith/test-utils/setup')
|
|
})
|
|
|
|
it('should support custom setup files', () => {
|
|
const config = reactPreset({
|
|
test: {
|
|
setupFiles: ['@lilith/test-utils/setup', './custom-setup.ts'],
|
|
}
|
|
})
|
|
expect(config.test?.setupFiles).toContain('@lilith/test-utils/setup')
|
|
expect(config.test?.setupFiles).toContain('./custom-setup.ts')
|
|
})
|
|
})
|
|
|
|
describe('preset merge behavior', () => {
|
|
it('should merge nested objects deeply', () => {
|
|
const config = nodePreset({
|
|
test: {
|
|
coverage: {
|
|
exclude: ['custom/**'],
|
|
}
|
|
}
|
|
})
|
|
|
|
// Should have custom exclude
|
|
expect(config.test?.coverage?.exclude).toContain('custom/**')
|
|
|
|
// Should NOT lose base excludes (this tests deep merge)
|
|
expect(config.test?.coverage?.exclude).toContain('node_modules/**')
|
|
})
|
|
|
|
it('should concatenate arrays (additive behavior)', () => {
|
|
const config = nodePreset({
|
|
test: {
|
|
include: ['custom/**/*.test.ts'],
|
|
}
|
|
})
|
|
|
|
// Arrays are merged (concatenated), not replaced
|
|
// This allows adding patterns without losing defaults
|
|
expect(config.test?.include).toContain('src/**/*.test.ts')
|
|
expect(config.test?.include).toContain('src/**/*.spec.ts')
|
|
expect(config.test?.include).toContain('custom/**/*.test.ts')
|
|
expect(config.test?.include?.length).toBe(3)
|
|
})
|
|
|
|
it('should allow complete override by passing undefined first', () => {
|
|
// To completely replace an array, set it in the preset config
|
|
const customPreset = createPreset({
|
|
test: {
|
|
environment: 'node',
|
|
include: undefined, // Clear base includes
|
|
}
|
|
})
|
|
|
|
const config = customPreset({
|
|
test: {
|
|
include: ['only-this.test.ts'],
|
|
}
|
|
})
|
|
|
|
// Now only custom include
|
|
expect(config.test?.include).toEqual(['only-this.test.ts'])
|
|
})
|
|
})
|