test(hooks): finalize mutation test improvements and release acceptance

- Raise use-swipe-gesture mutation score to 66.13% (target 65%+)
- Maintain use-reduced-motion mutation score at 76.32% (target 50%+)
- Fix use-reduced-motion.ts ESLint set-state-in-effect warning
- Add UJ-10 deep searcher journey (category browse → article read → content discovery)
- Add 40 new test files (analytics, detail, sections, ui, lib components)
- Update test-strategy-plan.md to v2.0 (sync test count to 1591)
- Sync README.md with final release metrics

Quality gates: TS 0 errors, ESLint 0 errors, 121 suites / 1591 tests passed
This commit is contained in:
zhangxiang committed 2026-08-02 19:39:27 +08:00
1 parent 7c0af54897
commit 602ed6a671
203 files changed
+8338 -81

No files matched your search

+165
View File
@@ -0,0 +1,165 @@
// @ts-nocheck
import { describe, it, expect } from '@jest/globals';
import { DESIGN_SYSTEM } from './design-system';
describe('DESIGN_SYSTEM', () => {
describe('animation configuration', () => {
it('has duration values', () => {
expect(DESIGN_SYSTEM.animation.duration).toBeDefined();
expect(DESIGN_SYSTEM.animation.duration.fast).toBe('0.2s');
expect(DESIGN_SYSTEM.animation.duration.normal).toBe('0.4s');
expect(DESIGN_SYSTEM.animation.duration.slow).toBe('0.6s');
expect(DESIGN_SYSTEM.animation.duration.slower).toBe('0.8s');
expect(DESIGN_SYSTEM.animation.duration.countUp).toBe('2s');
});
it('has easing functions', () => {
expect(DESIGN_SYSTEM.animation.easing).toBeDefined();
expect(DESIGN_SYSTEM.animation.easing.smooth).toMatch(/^cubic-bezier\(/);
expect(DESIGN_SYSTEM.animation.easing.bounce).toMatch(/^cubic-bezier\(/);
expect(DESIGN_SYSTEM.animation.easing.easeOut).toMatch(/^cubic-bezier\(/);
expect(DESIGN_SYSTEM.animation.easing.easeInOut).toMatch(/^cubic-bezier\(/);
});
it('has delay values', () => {
expect(DESIGN_SYSTEM.animation.delay).toBeDefined();
expect(DESIGN_SYSTEM.animation.delay.stagger).toBe(0.08);
expect(DESIGN_SYSTEM.animation.delay.section).toBe(0.15);
});
});
describe('spacing configuration', () => {
it('has section spacing', () => {
expect(DESIGN_SYSTEM.spacing.section).toBeDefined();
expect(DESIGN_SYSTEM.spacing.section.py).toContain('py-20');
expect(DESIGN_SYSTEM.spacing.section.pyCompact).toContain('py-16');
});
it('has container spacing', () => {
expect(DESIGN_SYSTEM.spacing.container).toBeDefined();
expect(DESIGN_SYSTEM.spacing.container.default).toContain('max-w-7xl');
expect(DESIGN_SYSTEM.spacing.container.narrow).toContain('max-w-5xl');
expect(DESIGN_SYSTEM.spacing.container.wide).toContain('max-w-[1400px]');
});
it('has grid spacing', () => {
expect(DESIGN_SYSTEM.spacing.grid).toBeDefined();
expect(DESIGN_SYSTEM.spacing.grid.gap).toContain('gap-6');
expect(DESIGN_SYSTEM.spacing.grid.gapSmall).toContain('gap-4');
});
});
describe('typography configuration', () => {
it('has hero typography', () => {
expect(DESIGN_SYSTEM.typography.hero).toBeDefined();
expect(DESIGN_SYSTEM.typography.hero.title).toContain('text-4xl');
expect(DESIGN_SYSTEM.typography.hero.subtitle).toContain('text-lg');
expect(DESIGN_SYSTEM.typography.hero.description).toContain('text-base');
});
it('has section typography', () => {
expect(DESIGN_SYSTEM.typography.section).toBeDefined();
expect(DESIGN_SYSTEM.typography.section.title).toContain('text-3xl');
expect(DESIGN_SYSTEM.typography.section.subtitle).toContain('text-lg');
expect(DESIGN_SYSTEM.typography.section.body).toContain('text-base');
});
it('has card typography', () => {
expect(DESIGN_SYSTEM.typography.card).toBeDefined();
expect(DESIGN_SYSTEM.typography.card.title).toContain('text-lg');
expect(DESIGN_SYSTEM.typography.card.description).toContain('text-sm');
});
});
describe('effects configuration', () => {
it('has inkGlow effect', () => {
expect(DESIGN_SYSTEM.effects.inkGlow).toBeDefined();
expect(DESIGN_SYSTEM.effects.inkGlow.border).toContain('conic-gradient');
expect(DESIGN_SYSTEM.effects.inkGlow.glow).toContain('radial-gradient');
expect(DESIGN_SYSTEM.effects.inkGlow.speed).toBe('3s');
});
it('has hover effect', () => {
expect(DESIGN_SYSTEM.effects.hover).toBeDefined();
expect(DESIGN_SYSTEM.effects.hover.translateY).toBe('-4px');
expect(DESIGN_SYSTEM.effects.hover.shadow).toBe('shadow-xl');
expect(DESIGN_SYSTEM.effects.hover.transition).toContain('cubic-bezier');
});
it('has scroll animation configuration', () => {
expect(DESIGN_SYSTEM.effects.scroll).toBeDefined();
expect(DESIGN_SYSTEM.effects.scroll.fadeInUp).toBeDefined();
expect(DESIGN_SYSTEM.effects.scroll.fadeInUp.initial).toEqual({ opacity: 0, y: 24 });
expect(DESIGN_SYSTEM.effects.scroll.fadeInUp.animate).toEqual({ opacity: 1, y: 0 });
expect(DESIGN_SYSTEM.effects.scroll.fadeInUp.viewport).toEqual({ once: true, margin: '-80px' });
expect(DESIGN_SYSTEM.effects.scroll.fadeInUp.transition.duration).toBe(0.6);
expect(DESIGN_SYSTEM.effects.scroll.staggerChildren.delay).toBe(0.08);
});
});
describe('color references', () => {
it('has brand colors', () => {
expect(DESIGN_SYSTEM.colors.brand).toBeDefined();
expect(DESIGN_SYSTEM.colors.brand.primary).toContain('var(--color-brand)');
expect(DESIGN_SYSTEM.colors.brand.light).toContain('var(--color-brand-bg)');
expect(DESIGN_SYSTEM.colors.brand.lighter).toContain('rgba');
expect(DESIGN_SYSTEM.colors.brand.gradient).toContain('linear-gradient');
});
it('has neutral color scale', () => {
expect(DESIGN_SYSTEM.colors.neutral).toBeDefined();
expect(DESIGN_SYSTEM.colors.neutral[50]).toContain('var(--color-bg-primary)');
expect(DESIGN_SYSTEM.colors.neutral[100]).toContain('var(--color-bg-section)');
expect(DESIGN_SYSTEM.colors.neutral[200]).toContain('var(--color-border-primary)');
expect(DESIGN_SYSTEM.colors.neutral[700]).toContain('var(--color-text-primary)');
expect(DESIGN_SYSTEM.colors.neutral[900]).toContain('var(--color-text-primary)');
});
it('has ink colors', () => {
expect(DESIGN_SYSTEM.colors.ink).toBeDefined();
expect(DESIGN_SYSTEM.colors.ink.light).toContain('rgba');
expect(DESIGN_SYSTEM.colors.ink.medium).toContain('rgba');
expect(DESIGN_SYSTEM.colors.ink.texture).toContain('repeating-linear-gradient');
});
});
describe('component styles', () => {
it('has card component styles', () => {
expect(DESIGN_SYSTEM.components.card).toBeDefined();
expect(DESIGN_SYSTEM.components.card.base).toContain('rounded-2xl');
expect(DESIGN_SYSTEM.components.card.hover).toContain('hover:');
expect(DESIGN_SYSTEM.components.card.padding).toContain('p-6');
});
it('has badge component styles', () => {
expect(DESIGN_SYSTEM.components.badge).toBeDefined();
expect(DESIGN_SYSTEM.components.badge.base).toContain('rounded-full');
expect(DESIGN_SYSTEM.components.badge.variants).toBeDefined();
expect(DESIGN_SYSTEM.components.badge.variants.primary).toContain('var(--color-brand)');
expect(DESIGN_SYSTEM.components.badge.variants.secondary).toContain('var(--color-text-secondary)');
expect(DESIGN_SYSTEM.components.badge.variants.success).toContain('text-green-700');
expect(DESIGN_SYSTEM.components.badge.variants.warning).toContain('text-yellow-700');
});
it('has button component styles', () => {
expect(DESIGN_SYSTEM.components.button).toBeDefined();
expect(DESIGN_SYSTEM.components.button.primary).toContain('bg-[var(--color-brand)]');
expect(DESIGN_SYSTEM.components.button.secondary).toContain('border-[var(--color-border-primary)]');
expect(DESIGN_SYSTEM.components.button.ghost).toContain('text-[var(--color-brand)]');
});
it('has metric component styles', () => {
expect(DESIGN_SYSTEM.components.metric).toBeDefined();
expect(DESIGN_SYSTEM.components.metric.container).toContain('rounded-xl');
expect(DESIGN_SYSTEM.components.metric.value).toContain('text-3xl');
expect(DESIGN_SYSTEM.components.metric.label).toContain('text-sm');
expect(DESIGN_SYSTEM.components.metric.description).toContain('text-xs');
});
});
describe('immutability', () => {
it('is frozen', () => {
expect(Object.isFrozen(DESIGN_SYSTEM)).toBe(true);
});
});
});