Files
novalon-website/test-analysis/test-results.txt
T
张翔 b207bfa7af feat: 增加测试覆盖率并优化代码质量
test: 添加单元测试和端到端测试
refactor: 重构登录页面和上传模块
ci: 更新测试覆盖率阈值至42%
build: 添加测试相关依赖
docs: 更新测试文档
style: 修复代码格式问题
2026-03-11 11:14:37 +08:00

1617 lines
60 KiB
Plaintext

> ruixin-website-react@0.1.0 test:unit
> jest --verbose --no-coverage
PASS src/db/mutations.test.ts
database mutations
user mutations
✓ should insert new user (3 ms)
✓ should update user (1 ms)
✓ should delete user (1 ms)
content mutations
✓ should insert new content (1 ms)
✓ should update content (1 ms)
✓ should delete content (1 ms)
✓ should publish content
site config mutations
✓ should insert new config
✓ should update config
✓ should upsert config (1 ms)
batch operations
✓ should insert multiple users
✓ should insert multiple content items
error handling
✓ should handle duplicate key error (10 ms)
✓ should handle foreign key constraint error (1 ms)
PASS src/lib/animations.test.tsx
Animation Variants
inkVariants
✓ should have correct hidden state (8 ms)
✓ should have correct visible state (2 ms)
✓ should have correct transition configuration (1 ms)
sealStampVariants
✓ should have correct hidden state
✓ should have correct visible state
✓ should use spring animation (1 ms)
brushStrokeVariants
✓ should have correct hidden state (1 ms)
✓ should have correct visible state
fadeUpVariants
✓ should have correct hidden state (1 ms)
✓ should have correct visible state
staggerContainerVariants
✓ should have staggerChildren configured (1 ms)
staggerItemVariants
✓ should have correct hidden state
✓ should have correct visible state
Animation Components
InkReveal
✓ should render children correctly (21 ms)
✓ should apply custom className (4 ms)
✓ should use inkVariants (2 ms)
SealStamp
✓ should render children correctly (2 ms)
✓ should apply custom className (3 ms)
FadeUp
✓ should render children correctly (2 ms)
✓ should apply custom duration (1 ms)
✓ should apply delay prop (1 ms)
StaggerContainer
✓ should render children correctly (3 ms)
✓ should apply custom staggerDelay (1 ms)
StaggerItem
✓ should render children correctly (1 ms)
RippleButton
✓ should render children correctly (3 ms)
✓ should handle click events (13 ms)
✓ should apply custom className (1 ms)
InkCard
✓ should render children correctly (1 ms)
✓ should apply custom hoverScale (1 ms)
CountUp
✓ should render with prefix and suffix (3 ms)
✓ should apply custom className (1 ms)
Typewriter
✓ should render component correctly (2 ms)
✓ should apply custom className (2 ms)
FloatingElement
✓ should render children correctly
✓ should apply custom amplitude (2 ms)
PulseElement
✓ should render children correctly (1 ms)
✓ should apply custom scale (1 ms)
GradientText
✓ should render children correctly (21 ms)
✓ should apply custom colors (11 ms)
SplitText
✓ should render text correctly (2 ms)
✓ should apply custom className (1 ms)
GlitchText
✓ should render text correctly (2 ms)
✓ should apply custom className (1 ms)
MagneticButton
✓ should render children correctly (2 ms)
✓ should handle click events (1 ms)
BlurReveal
✓ should render children correctly (1 ms)
✓ should apply custom className
WaveText
✓ should render text correctly (1 ms)
ShimmerButton
✓ should render children correctly (4 ms)
✓ should handle click events (2 ms)
Animation Hooks
useParallax
✓ should be defined
useSmoothSpring
✓ should be defined
SVG Components
InkDropSVG
✓ should render SVG correctly (2 ms)
✓ should apply custom className
InkSplash
✓ should render SVG correctly (2 ms)
✓ should apply custom color (1 ms)
✓ should apply custom size
PASS src/lib/email-templates.test.ts
Email Templates
generateNotificationEmail
✓ should generate valid HTML email (34 ms)
✓ should include customer name (1 ms)
✓ should include customer phone (1 ms)
✓ should include customer email
✓ should include message content
✓ should include company name
✓ should include submit time (1 ms)
✓ should include mailto link
✓ should include company address in footer (1 ms)
✓ should have proper email title
✓ should include responsive meta tag (1 ms)
✓ should include UTF-8 charset
✓ should handle long messages
✓ should handle special characters in name
✓ should handle special characters in message
generateConfirmationEmail
✓ should generate valid HTML email
✓ should include customer name (1 ms)
✓ should include message content
✓ should include company name
✓ should include company contact information
✓ should include expected response time
✓ should include working hours (1 ms)
✓ should have proper email title
✓ should include success icon
✓ should include current year in footer (1 ms)
✓ should include responsive meta tag
✓ should include UTF-8 charset
✓ should handle long messages
✓ should handle special characters in name
Email Template Structure
✓ should have consistent styling in notification email (1 ms)
✓ should have consistent styling in confirmation email
✓ should use brand colors in notification email
✓ should use brand colors in confirmation email
✓ should have proper container structure in notification email (2 ms)
✓ should have proper container structure in confirmation email
Edge Cases
✓ should handle empty message
✓ should handle empty name
✓ should handle email with special characters (1 ms)
✓ should handle phone number with spaces
✓ should handle unicode characters in message
Performance Tests
✓ should generate notification email quickly (5 ms)
✓ should generate confirmation email quickly
PASS src/components/ui/sheet.test.tsx
Sheet
Rendering
✓ should render sheet trigger (36 ms)
✓ should render sheet content when open (82 ms)
✓ should render sheet title (30 ms)
✓ should render sheet description (15 ms)
✓ should render sheet footer (12 ms)
Interaction
✓ should open sheet on trigger click (10 ms)
✓ should close sheet on close button click (23 ms)
Sides
✓ should render right side by default (8 ms)
✓ should render left side (7 ms)
✓ should render top side (14 ms)
✓ should render bottom side (9 ms)
Styling
✓ should apply custom className to content (9 ms)
✓ should apply custom className to header (16 ms)
✓ should apply custom className to footer (10 ms)
Close Button
✓ should show close button by default (12 ms)
✓ should hide close button when showCloseButton is false (9 ms)
PASS src/components/sections/products-section.test.tsx
ProductsSection
Rendering
✓ should render products section (56 ms)
✓ should render section heading (47 ms)
✓ should render section description (35 ms)
Product Cards
✓ should render product cards (16 ms)
✓ should display products in grid layout (23 ms)
✓ should render product categories (28 ms)
✓ should render product features (13 ms)
Custom Solution Section
✓ should render custom solution section (21 ms)
✓ should render custom solution description (17 ms)
✓ should render contact button (55 ms)
✓ should link to contact page (35 ms)
Accessibility
✓ should have region role (16 ms)
✓ should have aria-labelledby attribute (15 ms)
✓ should have accessible heading (17 ms)
Styling
✓ should have background color (11 ms)
✓ should have proper padding (16 ms)
✓ should have decorative background elements (14 ms)
PASS src/components/sections/services-section.test.tsx
ServicesSection
Rendering
✓ should render services section (19 ms)
✓ should render section heading (22 ms)
✓ should render section description (8 ms)
Service Cards
✓ should render service cards (12 ms)
✓ should display services in grid layout (10 ms)
✓ should render service icons (5 ms)
Call to Action
✓ should render view all services button (22 ms)
✓ should link to services page (19 ms)
Accessibility
✓ should have section with id (7 ms)
✓ should have aria-labelledby attribute (13 ms)
✓ should have accessible heading (5 ms)
Styling
✓ should have white background (11 ms)
✓ should have proper padding (8 ms)
✓ should have decorative background elements (7 ms)
PASS src/components/sections/contact-section.test.tsx
ContactSection
Rendering
✓ should render contact section (48 ms)
✓ should render contact form (13 ms)
✓ should render submit button (55 ms)
✓ should render company contact information (18 ms)
✓ should render work hours card (16 ms)
Form Validation
✓ should show error for invalid name (53 ms)
✓ should show error for invalid phone (82 ms)
✓ should show error for invalid email (118 ms)
✓ should show error for short message (43 ms)
Accessibility
✓ should have proper form labels (12 ms)
✓ should have proper ARIA attributes (8 ms)
CSRF Protection
✓ should generate CSRF token on mount (5 ms)
PASS src/components/ui/animated-card.test.tsx
Animated Cards
InkCard
✓ should render ink card (30 ms)
✓ should apply custom className (5 ms)
✓ should handle mouse move (2 ms)
✓ should handle hover events (4 ms)
GeometricCard
✓ should render geometric card (3 ms)
✓ should apply custom className (1 ms)
✓ should have corner decorations (2 ms)
FlipCard
✓ should render flip card (2 ms)
✓ should flip on click (1 ms)
✓ should apply custom className (1 ms)
TiltCard
✓ should render tilt card (1 ms)
✓ should apply custom className
✓ should handle mouse move (1 ms)
✓ should handle mouse leave (1 ms)
GlowCard
✓ should render glow card (27 ms)
✓ should apply custom className (1 ms)
✓ should handle mouse move (8 ms)
ExpandCard
✓ should render expand card (1 ms)
✓ should apply custom className
✓ should expand on click (2 ms)
PASS src/components/ui/textarea.test.tsx
Textarea
Rendering
✓ should render textarea element (18 ms)
✓ should render with label (2 ms)
✓ should render required indicator when required (1 ms)
✓ should render error message (2 ms)
✓ should render with placeholder (1 ms)
✓ should render with custom data-testid (2 ms)
✓ should render with default rows (1 ms)
User Interaction
✓ should handle user input (26 ms)
✓ should handle onChange event (12 ms)
✓ should handle onBlur event (22 ms)
✓ should handle onFocus event (11 ms)
✓ should handle multiline input (22 ms)
Disabled State
✓ should be disabled when disabled prop is true (5 ms)
✓ should not accept input when disabled (2 ms)
Accessibility
✓ should have aria-required when required (2 ms)
✓ should have aria-invalid when error exists (1 ms)
✓ should have aria-describedby when error exists (1 ms)
✓ should have proper label association (1 ms)
✓ should have role="alert" on error message (1 ms)
Custom Styling
✓ should apply custom className (2 ms)
✓ should have error styling when error exists (2 ms)
Ref Forwarding
✓ should forward ref to textarea element (3 ms)
Value Handling
✓ should display controlled value (3 ms)
✓ should display defaultValue (2 ms)
MaxLength
✓ should respect maxLength attribute (1 ms)
PASS src/components/ui/input.test.tsx
Input
Rendering
✓ should render input element (8 ms)
✓ should render with label (2 ms)
✓ should render required indicator when required (1 ms)
✓ should render error message (3 ms)
✓ should render with placeholder (1 ms)
✓ should render with custom data-testid (1 ms)
Types
✓ should render text input by default (3 ms)
✓ should render email input (6 ms)
✓ should render password input (1 ms)
✓ should render tel input (4 ms)
User Interaction
✓ should handle user input (30 ms)
✓ should handle onChange event (15 ms)
✓ should handle onBlur event (19 ms)
✓ should handle onFocus event (8 ms)
Disabled State
✓ should be disabled when disabled prop is true (2 ms)
✓ should not accept input when disabled (2 ms)
Accessibility
✓ should have aria-required when required (1 ms)
✓ should have aria-invalid when error exists (2 ms)
✓ should have aria-describedby when error exists (1 ms)
✓ should have proper label association (1 ms)
✓ should have role="alert" on error message (3 ms)
Custom Styling
✓ should apply custom className (2 ms)
✓ should have error styling when error exists (2 ms)
Ref Forwarding
✓ should forward ref to input element (2 ms)
PASS src/components/layout/header.test.tsx
Header
Rendering
✓ should render header component (12 ms)
✓ should render logo (3 ms)
✓ should render desktop navigation (2 ms)
✓ should render navigation items (3 ms)
✓ should render consult button (3 ms)
✓ should render mobile menu button (6 ms)
Mobile Menu
✓ should toggle mobile menu on button click (10 ms)
✓ should show X icon when menu is open (6 ms)
✓ should show Menu icon when menu is closed (1 ms)
Accessibility
✓ should have proper ARIA attributes on menu button (1 ms)
✓ should update aria-expanded when menu is toggled (7 ms)
✓ should have proper navigation role (3 ms)
Navigation
✓ should have correct href for navigation items (3 ms)
PASS src/components/ui/dropdown-menu.test.tsx
DropdownMenu
Rendering
✓ should render dropdown menu trigger (8 ms)
✓ should render menu items (31 ms)
✓ should render menu label (19 ms)
✓ should render separator (19 ms)
Interaction
✓ should open menu on trigger click (2 ms)
✓ should close menu on item click (34 ms)
DropdownMenuShortcut
✓ should render shortcut text (20 ms)
Styling
✓ should apply custom className to trigger (2 ms)
✓ should apply custom className to content (15 ms)
✓ should apply custom className to item (17 ms)
PASS src/lib/integration.test.ts
Integration Tests
Input Sanitization Flow
✓ should sanitize user input end-to-end (6 ms)
✓ should sanitize HTML content (7 ms)
✓ should sanitize URLs
CSRF Protection Flow
✓ should generate and validate CSRF tokens (1 ms)
✓ should reject invalid CSRF tokens
✓ should reject empty tokens
File Validation Flow
✓ should validate allowed file types (1 ms)
✓ should reject dangerous file types
✓ should validate file signatures
Color Contrast Validation Flow
✓ should validate accessible color combinations
✓ should reject inaccessible color combinations
✓ should calculate contrast ratios correctly
Performance Monitoring Flow
✓ should track metrics across operations (1 ms)
✓ should track multiple metrics independently
Combined Security Validation Flow
✓ should validate and sanitize user input comprehensively (3 ms)
✓ should validate file upload with CSRF protection
PASS src/components/layout/mobile-menu.test.tsx
MobileMenu
Rendering
✓ should render menu button (7 ms)
✓ should render menu icon when closed (2 ms)
✓ should not render menu panel when closed (1 ms)
Opening Menu
✓ should open menu when button clicked (11 ms)
✓ should change button label when open (12 ms)
✓ should render navigation items (8 ms)
Closing Menu
✓ should close menu when button clicked again (8 ms)
✓ should close menu when overlay clicked (4 ms)
Keyboard Navigation
✓ should open menu with Enter key (4 ms)
✓ should open menu with Space key (9 ms)
✓ should close menu with Escape key (7 ms)
Accessibility
✓ should have aria-expanded attribute (2 ms)
✓ should update aria-expanded when open (4 ms)
✓ should have aria-controls attribute (2 ms)
✓ should have navigation role (3 ms)
Styling
✓ should have responsive visibility
✓ should apply custom className (1 ms)
PASS src/components/ui/insight-card.test.tsx
InsightCard
Rendering
✓ should render insight card (5 ms)
✓ should render title (6 ms)
✓ should render excerpt (7 ms)
✓ should render category badge (2 ms)
✓ should render read time (6 ms)
✓ should render published date (2 ms)
✓ should render read more link (2 ms)
Image
✓ should render image when imageUrl is provided (2 ms)
✓ should not render image when imageUrl is not provided (4 ms)
Featured
✓ should not be featured by default (2 ms)
✓ should be featured when featured prop is true (2 ms)
Styling
✓ should have article element (2 ms)
✓ should have border class (1 ms)
✓ should have rounded class (2 ms)
PASS src/components/ui/button.test.tsx
Button Component
Rendering
✓ should render button with text (14 ms)
✓ should render as a button element by default (5 ms)
✓ should apply default variant styles (4 ms)
Variants
✓ should apply secondary variant styles (5 ms)
✓ should apply outline variant styles (4 ms)
✓ should apply ghost variant styles (4 ms)
✓ should apply link variant styles (2 ms)
✓ should apply destructive variant styles (6 ms)
Sizes
✓ should apply default size styles (2 ms)
✓ should apply small size styles (1 ms)
✓ should apply large size styles (2 ms)
✓ should apply icon size styles (2 ms)
Accessibility
✓ should be focusable (2 ms)
✓ should have proper disabled state (1 ms)
✓ should have focus visible styles (1 ms)
Custom Props
✓ should apply custom className (1 ms)
✓ should pass through additional props (1 ms)
✓ should handle click events (2 ms)
Touch Support
✓ should have touch manipulation (3 ms)
✓ should have minimum touch target size (1 ms)
PASS src/components/ui/touch-swipe.test.tsx
TouchSwipe
Rendering
✓ should render children (5 ms)
✓ should apply custom className (1 ms)
Touch Events
✓ should handle touch start (1 ms)
✓ should handle touch end (1 ms)
✓ should call onSwipeLeft when swiping left
✓ should call onSwipeRight when swiping right (1 ms)
✓ should not trigger swipe when below threshold (1 ms)
Threshold
✓ should use default threshold of 50
✓ should accept custom threshold (1 ms)
PASS src/components/sections/news-section.test.tsx
NewsSection
Rendering
✓ should render news section (11 ms)
✓ should render section heading (16 ms)
✓ should render section description (7 ms)
News Cards
✓ should render news cards (12 ms)
✓ should display news in grid layout (6 ms)
✓ should render news categories (7 ms)
✓ should render news dates (17 ms)
Call to Action
✓ should render view all news link (14 ms)
✓ should link to news page (11 ms)
✓ should render read more links (11 ms)
Accessibility
✓ should have region role (12 ms)
✓ should have aria-labelledby attribute (9 ms)
✓ should have accessible heading (10 ms)
Styling
✓ should have background color (6 ms)
✓ should have proper padding (5 ms)
✓ should have container styling (5 ms)
PASS src/lib/monitoring.test.ts
PerformanceMonitor
getInstance
✓ should return singleton instance
recordMetric
✓ should record a metric value (1 ms)
✓ should record multiple metric values
✓ should maintain max 1000 values per metric
getAverage
✓ should return 0 for empty metric
✓ should calculate average correctly
getPercentile
✓ should return 0 for empty metric
✓ should calculate 50th percentile correctly
✓ should calculate 95th percentile correctly
✓ should calculate 99th percentile correctly
getCount
✓ should return 0 for non-existent metric
✓ should return count for existing metric (1 ms)
getMin
✓ should return 0 for empty metric
✓ should return minimum value
getMax
✓ should return 0 for empty metric
✓ should return maximum value
getStats
✓ should return stats for empty metric
✓ should return complete stats for metric (1 ms)
clearMetrics
✓ should clear specific metric
✓ should clear all metrics when no name provided
PASS src/components/sections/about-section.test.tsx
AboutSection
Rendering
✓ should render about section (9 ms)
✓ should render section heading (6 ms)
✓ should render company slogan (2 ms)
✓ should render company mission (7 ms)
Statistics
✓ should render statistics cards (2 ms)
✓ should display statistics in grid layout (3 ms)
Call to Action
✓ should render learn more button (7 ms)
✓ should link to about page (6 ms)
Accessibility
✓ should have region role (4 ms)
✓ should have aria-labelledby attribute (2 ms)
✓ should have accessible heading (7 ms)
Styling
✓ should have background color (4 ms)
✓ should have proper padding (2 ms)
✓ should have decorative background pattern (5 ms)
PASS src/components/ui/dialog.test.tsx
Dialog Components
Dialog
✓ should render dialog root (3 ms)
DialogTrigger
✓ should render trigger button (10 ms)
DialogContent
✓ should render content with children (5 ms)
✓ should apply custom className (1 ms)
DialogHeader
✓ should render header with children (1 ms)
✓ should apply custom className (3 ms)
DialogFooter
✓ should render footer with children (1 ms)
✓ should apply custom className (4 ms)
DialogTitle
✓ should render title text (1 ms)
✓ should render as h2 element (1 ms)
✓ should apply custom className (1 ms)
DialogDescription
✓ should render description text (1 ms)
✓ should apply custom className
Dialog Composition
✓ should render complete dialog structure (4 ms)
Accessibility
✓ should have accessible title (1 ms)
✓ should support custom ARIA attributes (3 ms)
PASS src/components/sections/cases-section.test.tsx
CasesSection
Rendering
✓ should render cases section (12 ms)
✓ should render section heading (16 ms)
✓ should render section description (5 ms)
✓ should render case cards (10 ms)
✓ should render client names (5 ms)
✓ should render industry badges (6 ms)
✓ should render results (15 ms)
✓ should render view more button (9 ms)
Accessibility
✓ should have section id (13 ms)
✓ should have region role (12 ms)
✓ should have aria-labelledby (8 ms)
Styling
✓ should have correct background (13 ms)
✓ should have container (9 ms)
PASS src/components/layout/footer.test.tsx
Footer
Rendering
✓ should render footer component (9 ms)
✓ should render logo (4 ms)
✓ should render company description (4 ms)
✓ should render quick links section (6 ms)
✓ should render service items section (11 ms)
✓ should render contact information section (5 ms)
✓ should render navigation links (9 ms)
✓ should render service links (18 ms)
✓ should render contact details (5 ms)
Icons
✓ should render contact icons (6 ms)
Legal Links
✓ should render privacy policy link (14 ms)
✓ should render terms of service link (8 ms)
✓ should render ICP filing info (10 ms)
✓ should render police filing info (6 ms)
Copyright
✓ should render copyright with current year (6 ms)
✓ should render company name in copyright (9 ms)
Accessibility
✓ should have proper role attribute (15 ms)
✓ should have proper link hrefs (7 ms)
QR Code Section
✓ should render QR code image (11 ms)
✓ should render QR code description (19 ms)
PASS src/components/sections/hero-section.test.tsx
HeroSection
Rendering
✓ should render hero section (14 ms)
✓ should render company name (13 ms)
✓ should render features (17 ms)
Statistics
✓ should render statistics section (18 ms)
Accessibility
✓ should have proper ARIA labels (10 ms)
✓ should have accessible buttons (33 ms)
PASS src/lib/auth/session.test.ts
session management
createSession
✓ should create session with user data
✓ should create session with createdAt timestamp
✓ should create session with 24 hour expiration
✓ should create session without optional role
isSessionValid
✓ should return true for valid session
✓ should return false for expired session
✓ should return false for session with zero expiration time
✓ should return true for session with 1ms remaining
getSessionAge
✓ should return age of session in milliseconds (1 ms)
✓ should increase over time (10 ms)
getSessionTimeRemaining
✓ should return positive time for valid session (1 ms)
✓ should return approximately 24 hours for new session
✓ should return 0 for expired session
✓ should return 0 for session at exact expiration time
isSessionExpired
✓ should return false for valid session
✓ should return true for expired session
✓ should return true for session at exact expiration time
✓ should return false for session with 1ms remaining
createSessionWithCustomExpiration
✓ should create session with custom expiration time
✓ should create session with negative expiration time
✓ should preserve user data (1 ms)
session lifecycle
✓ should track session from creation to expiration (157 ms)
✓ should have consistent age and time remaining
session data integrity
✓ should maintain session data immutability (1 ms)
✓ should handle empty role gracefully (4 ms)
✓ should handle special characters in userId (17 ms)
PASS src/components/ui/glass-card.test.tsx
GlassCard
Rendering
✓ should render glass card (20 ms)
✓ should render children (22 ms)
✓ should apply custom className (5 ms)
Variants
✓ should render default variant (11 ms)
✓ should render elevated variant (2 ms)
✓ should render outline variant (2 ms)
✓ should render glow variant (1 ms)
Styling
✓ should have rounded class (2 ms)
✓ should have border class (21 ms)
✓ should have backdrop-blur class (3 ms)
Forward Ref
✓ should forward ref (2 ms)
PASS src/components/ui/badge.test.tsx
Badge
Rendering
✓ should render badge with text (9 ms)
✓ should render as span by default (4 ms)
✓ should have data-slot attribute (21 ms)
Variants
✓ should render default variant (3 ms)
✓ should render secondary variant (3 ms)
✓ should render destructive variant (2 ms)
✓ should render outline variant (3 ms)
✓ should render ghost variant (2 ms)
✓ should render success variant (2 ms)
✓ should render warning variant (2 ms)
✓ should render info variant (2 ms)
Styling
✓ should apply custom className (2 ms)
✓ should have rounded-full class (1 ms)
✓ should have inline-flex class (4 ms)
AsChild
✓ should render as child component when asChild is true (5 ms)
PASS src/components/layout/mobile-tab-bar.test.tsx
MobileTabBar
Rendering
✓ should render tab bar (25 ms)
✓ should render all tabs (163 ms)
✓ should render tab icons (89 ms)
Active State
✓ should highlight active tab (107 ms)
✓ should show active indicator (24 ms)
Navigation Links
✓ should have correct href for home (58 ms)
✓ should have correct href for services (18 ms)
✓ should have correct href for products (10 ms)
✓ should have correct href for news (7 ms)
✓ should have correct href for contact (4 ms)
Accessibility
✓ should have navigation role (14 ms)
✓ should have accessible tab labels (18 ms)
Styling
✓ should have fixed positioning (10 ms)
✓ should have responsive visibility (9 ms)
✓ should have backdrop blur (12 ms)
✓ should have proper height (10 ms)
PASS src/components/ui/page-header.test.tsx
PageHeader
Rendering
✓ should render page header (15 ms)
✓ should render title (3 ms)
✓ should render description when provided (3 ms)
✓ should not render description when not provided (27 ms)
✓ should render badge when provided (16 ms)
✓ should not render badge when not provided (6 ms)
Effects
✓ should render ink background (3 ms)
✓ should render data particle flow (3 ms)
✓ should render subtle dots (3 ms)
Styling
✓ should have container class (13 ms)
✓ should apply custom className (3 ms)
PASS src/hooks/use-media-query.test.ts
useMediaQuery
useMediaQuery
✓ should return false on server side (9 ms)
✓ should return boolean value (2 ms)
useIsMobile
✓ should return boolean value (3 ms)
✓ should use correct media query (2 ms)
useIsTablet
✓ should return boolean value (1 ms)
✓ should use correct media query (1 ms)
useIsDesktop
✓ should return boolean value (1 ms)
✓ should use correct media query (2 ms)
Media Query Behavior
✓ should handle different queries (2 ms)
✓ should handle complex queries (1 ms)
PASS src/components/ui/animated-number.test.tsx
AnimatedNumber
Rendering
✓ should render number (8 ms)
✓ should render with prefix (1 ms)
✓ should render with suffix (1 ms)
✓ should render with prefix and suffix (6 ms)
✓ should render with custom className (1 ms)
Animation
✓ should accept duration prop (5 ms)
✓ should accept delay prop (1 ms)
✓ should start from 0
Edge Cases
✓ should handle zero value (1 ms)
✓ should handle large numbers (1 ms)
✓ should handle decimal numbers
StatCard
Rendering
✓ should render stat card (1 ms)
✓ should render with prefix (1 ms)
✓ should render with suffix (1 ms)
✓ should render with prefix and suffix (1 ms)
✓ should render with index (1 ms)
Styling
✓ should have text-center class (1 ms)
✓ should have group class (1 ms)
PASS src/components/ui/testimonial-card.test.tsx
TestimonialCard
Rendering
✓ should render testimonial card (4 ms)
✓ should render author name (9 ms)
✓ should render position and company (3 ms)
✓ should render quote with quotes (2 ms)
Rating
✓ should render 5 stars by default (1 ms)
✓ should render custom rating (1 ms)
✓ should not render stars when rating is 0 (1 ms)
Avatar
✓ should render avatar when avatarUrl is provided (3 ms)
✓ should not render avatar when avatarUrl is not provided (2 ms)
Styling
✓ should have correct card classes (2 ms)
✓ should have border class (1 ms)
✓ should have background class (2 ms)
PASS src/components/ui/toast.test.tsx
Toast Component
Rendering
✓ should render toast with message (5 ms)
✓ should render with success type by default (4 ms)
✓ should render with error type (2 ms)
✓ should render with info type (2 ms)
✓ should render close button (5 ms)
Auto-close
✓ should auto-close after default duration (3000ms) (15 ms)
✓ should auto-close after custom duration (13 ms)
✓ should cleanup timer on unmount (1 ms)
Manual Close
✓ should close when close button clicked (5 ms)
Accessibility
✓ should have alert role (3 ms)
✓ should have aria-live attribute (3 ms)
✓ should have accessible close button (5 ms)
Data Attributes
✓ should support custom data-testid (3 ms)
Icons
✓ should render success icon for success type (4 ms)
✓ should render error icon for error type (5 ms)
✓ should render info icon for info type (2 ms)
Styling
✓ should apply success background color (2 ms)
✓ should apply error background color (1 ms)
✓ should apply info background color (3 ms)
PASS src/hooks/use-focus-trap.test.ts
useFocusTrap
Initial State
✓ should return a ref (4 ms)
When Active
✓ should store previous active element (1 ms)
✓ should add keydown event listener (1 ms)
✓ should set body overflow to hidden (1 ms)
When Inactive
✓ should not add keydown event listener
✓ should not set body overflow (1 ms)
Cleanup
✓ should remove keydown event listener on unmount (1 ms)
✓ should restore body overflow on unmount (2 ms)
Tab Navigation
✓ should handle Tab key press (5 ms)
✓ should handle Shift+Tab key press
Escape Key
✓ should handle Escape key press (1 ms)
State Changes
✓ should handle activation change (1 ms)
PASS src/components/ui/optimized-image.test.tsx
OptimizedImage
Rendering
✓ should render optimized image (8 ms)
✓ should render with alt text (1 ms)
✓ should apply custom className (1 ms)
✓ should apply container className (1 ms)
Loading States
✓ should handle onLoad event (2 ms)
✓ should handle onError event (2 ms)
✓ should show error state on error (7 ms)
Object Fit
✓ should apply cover object fit by default (1 ms)
✓ should apply contain object fit (2 ms)
✓ should apply fill object fit (2 ms)
✓ should apply none object fit (1 ms)
✓ should apply scale-down object fit (1 ms)
Fill Mode
✓ should render in fill mode
Priority
✓ should handle priority prop (1 ms)
PASS src/components/sections/insights-section.test.tsx
InsightsSection
Rendering
✓ should render insights section (8 ms)
✓ should render section heading (15 ms)
✓ should render section description (6 ms)
✓ should render insight cards (3 ms)
✓ should render insight titles (2 ms)
✓ should render insight categories (8 ms)
✓ should render view all button (3 ms)
Accessibility
✓ should have section id (4 ms)
Styling
✓ should have correct background (10 ms)
✓ should have container (2 ms)
✓ should have grid layout (2 ms)
PASS src/components/ui/error-boundary.test.tsx
ErrorBoundary
Normal Rendering
✓ should render children when no error (2 ms)
✓ should not show error UI when no error (6 ms)
Error Handling
✓ should catch errors and display fallback UI (19 ms)
✓ should display default error message (2 ms)
✓ should display custom fallback if provided (2 ms)
✓ should log error to console (2 ms)
Error Recovery
✓ should have retry button (6 ms)
Accessibility
✓ should have accessible error icon (3 ms)
✓ should have accessible retry button (4 ms)
Styling
✓ should have centered layout (2 ms)
✓ should have error icon with red background (1 ms)
✓ should have styled retry button (8 ms)
PASS src/components/sections/testimonials-section.test.tsx
TestimonialsSection
Rendering
✓ should render testimonials section (4 ms)
✓ should render section heading (5 ms)
✓ should render section description (2 ms)
✓ should render testimonial cards (3 ms)
✓ should render testimonial authors (8 ms)
✓ should render testimonial quotes (4 ms)
Accessibility
✓ should have section id (7 ms)
Styling
✓ should have correct background (2 ms)
✓ should have container (2 ms)
✓ should have grid layout (5 ms)
PASS src/components/ui/loading-skeleton.test.tsx
Loading Skeleton Components
Skeleton
✓ should render skeleton element (2 ms)
✓ should apply default styles (1 ms)
✓ should apply custom className (1 ms)
CardSkeleton
✓ should render card skeleton (1 ms)
✓ should have correct structure (2 ms)
ServiceCardSkeleton
✓ should render service card skeleton (1 ms)
✓ should have full height (2 ms)
CaseCardSkeleton
✓ should render case card skeleton (1 ms)
✓ should have image placeholder (2 ms)
ProductCardSkeleton
✓ should render product card skeleton (1 ms)
✓ should have flex column layout (1 ms)
NewsCardSkeleton
✓ should render news card skeleton (1 ms)
✓ should have image placeholder
SectionSkeleton
✓ should render section skeleton (11 ms)
✓ should render multiple service card skeletons (5 ms)
Accessibility
✓ should not have any accessible content (3 ms)
✓ should be purely decorative (11 ms)
Animation
✓ should have pulse animation (2 ms)
✓ should apply animation to all skeleton elements (2 ms)
PASS src/lib/upload.test.ts
Upload Module
getFileExtension
✓ should return correct extension for JPEG (2 ms)
✓ should return correct extension for PNG (1 ms)
✓ should return correct extension for PDF
✓ should return empty string for unknown MIME type
isAllowedType
✓ should return true for allowed image types (1 ms)
✓ should return true for allowed document types
✓ should return false for disallowed types
✓ should return false for unknown MIME types
✓ should handle null type
✓ should handle undefined type (1 ms)
✓ should handle empty string type
✓ should handle invalid category
validateFileSignature
✓ should validate JPEG signature correctly
✓ should validate PNG signature correctly
✓ should validate PDF signature correctly
✓ should return false for invalid JPEG signature
✓ should return true for SVG files
✓ should return true for unknown MIME types (2 ms)
sanitizeFileName
✓ should remove special characters
✓ should convert to lowercase
✓ should replace multiple dots
✓ should preserve Chinese characters
✓ should preserve underscores and hyphens
isDangerousFile
✓ should detect .exe files as dangerous (1 ms)
✓ should detect .bat files as dangerous
✓ should detect .php files as dangerous
✓ should detect .js files as dangerous
✓ should not flag safe files as dangerous (1 ms)
✓ should be case insensitive
getDatePath
✓ should return correct date path format
✓ should pad month and day with zeros
uploadFile
✓ should upload a valid image file successfully (1 ms)
✓ should reject files exceeding size limit (12 ms)
✓ should reject disallowed file types (1 ms)
✓ should reject dangerous file extensions
✓ should reject files with mismatched signatures (1 ms)
✓ should create upload directory if it does not exist
✓ should include userId in upload result
✓ should sanitize file name
deleteFile
✓ should delete existing file successfully (1 ms)
✓ should return false for non-existent file
✓ should return false on deletion error
getFileInfo
✓ should return file information for existing file (1 ms)
✓ should return null for non-existent file
Security Tests
✓ should prevent path traversal attacks
✓ should prevent double extension attacks (1 ms)
✓ should validate file signatures to prevent MIME type spoofing
✓ should reject all dangerous file extensions (1 ms)
PASS src/hooks/use-scroll-reveal.test.ts
useScrollReveal
useScrollReveal
✓ should return ref and isVisible state (4 ms)
✓ should accept custom options (4 ms)
✓ should use default options (1 ms)
useScrollProgress
✓ should return progress value
✓ should accept threshold option (1 ms)
✓ should use default threshold
useParallax
✓ should return ref and offset (1 ms)
✓ should accept speed option
✓ should use default speed (1 ms)
✓ should handle different speed values
Cleanup
✓ should cleanup intersection observer on unmount (1 ms)
✓ should cleanup scroll listener on unmount
✓ should cleanup parallax scroll listener on unmount (1 ms)
PASS src/components/ui/touch-button.test.tsx
TouchButton
Rendering
✓ should render button with text (7 ms)
✓ should render button element (4 ms)
✓ should apply custom className (1 ms)
Variants
✓ should render primary variant by default (1 ms)
✓ should render secondary variant
✓ should render ghost variant (1 ms)
Sizes
✓ should render small size (1 ms)
✓ should render medium size by default
✓ should render large size (1 ms)
Full Width
✓ should not be full width by default (1 ms)
✓ should be full width when fullWidth is true (1 ms)
Disabled State
✓ should not be disabled by default (2 ms)
✓ should be disabled when disabled prop is true (2 ms)
Touch Events
✓ should handle touch start (2 ms)
✓ should handle touch end (2 ms)
✓ should handle touch cancel (3 ms)
Click Events
✓ should handle click events (4 ms)
PASS src/hooks/use-intersection-observer.test.ts
useIntersectionObserver
Initial State
✓ should return ref and isIntersecting state (1 ms)
✓ should return ref with null current value (1 ms)
Options
✓ should accept threshold option
✓ should accept root option (1 ms)
✓ should accept rootMargin option
✓ should accept freezeOnceVisible option (1 ms)
✓ should use default options
✓ should accept multiple thresholds
Behavior
✓ should not observe when freezeOnceVisible is true and already intersecting (1 ms)
Cleanup
✓ should cleanup observer on unmount
Type Safety
✓ should work with different element types (3 ms)
PASS src/components/ui/card.test.tsx
Card Components
Card
✓ should render card with children (5 ms)
✓ should have proper data-slot attribute (1 ms)
✓ should apply default styles (1 ms)
✓ should apply custom className (1 ms)
✓ should have hover effects (1 ms)
CardHeader
✓ should render header with children (1 ms)
✓ should have proper data-slot attribute (2 ms)
✓ should apply default styles (2 ms)
CardTitle
✓ should render title text (2 ms)
✓ should have proper data-slot attribute (2 ms)
✓ should apply default styles
CardDescription
✓ should render description text (1 ms)
✓ should have proper data-slot attribute (3 ms)
✓ should apply default styles (2 ms)
CardAction
✓ should render action content (1 ms)
✓ should have proper data-slot attribute (2 ms)
✓ should apply default styles
CardContent
✓ should render content (1 ms)
✓ should have proper data-slot attribute
✓ should apply default styles (1 ms)
CardFooter
✓ should render footer content (2 ms)
✓ should have proper data-slot attribute
✓ should apply default styles (1 ms)
Card Composition
✓ should render complete card structure (1 ms)
✓ should allow nested components (1 ms)
Accessibility
✓ should be accessible as a div element (1 ms)
✓ should support custom ARIA attributes (4 ms)
PASS src/lib/auth/check-permission.test.ts
check-permission
checkPermission
✓ should return allowed: false when no session (1 ms)
✓ should return allowed: false when no user (2 ms)
✓ should return allowed: true for admin with valid permission
✓ should return allowed: false for viewer with invalid permission
✓ should return allowed: true for editor with valid permission (1 ms)
✓ should return allowed: false for editor with delete permission
✓ should handle different resources
requirePermission
✓ should throw error when no permission (6 ms)
✓ should return userId and role when has permission
✓ should throw error when no session (1 ms)
✓ should allow editor to publish content
✓ should deny viewer to update config
PASS src/lib/validation.test.ts
validation
email validation
✓ should accept valid email
✓ should reject invalid email
✓ should reject null or undefined
✓ should reject non-string values
phone validation
✓ should accept valid phone numbers
✓ should reject invalid phone numbers
✓ should reject null or undefined
✓ should reject non-string values
password validation
✓ should accept valid passwords (1 ms)
✓ should reject short passwords
✓ should reject null or undefined (2 ms)
✓ should reject non-string values
URL validation
✓ should accept valid URLs (2 ms)
✓ should reject invalid URLs
✓ should reject null or undefined (1 ms)
✓ should reject non-string values
required validation
✓ should accept non-empty strings
✓ should reject empty strings
✓ should accept valid numbers
✓ should reject NaN
✓ should accept non-empty arrays (1 ms)
✓ should reject empty arrays
✓ should accept objects
✓ should reject null and undefined
✓ should accept booleans
length validation
✓ should accept strings within range
✓ should reject strings shorter than minimum
✓ should reject strings longer than maximum
✓ should reject non-string values (1 ms)
range validation
✓ should accept numbers within range
✓ should reject numbers below minimum
✓ should reject numbers above maximum
✓ should reject NaN
✓ should reject non-number values (1 ms)
Chinese ID validation
✓ should accept valid Chinese ID numbers
✓ should reject invalid Chinese ID numbers
✓ should reject null or undefined
✓ should reject non-string values
username validation
✓ should accept valid usernames (1 ms)
✓ should reject usernames with special characters
✓ should reject usernames that are too short
✓ should reject usernames that are too long
✓ should reject null or undefined
✓ should reject non-string values
PASS src/app/api/contact/route.test.ts
/api/contact
✓ should handle POST request with valid data (25 ms)
✓ should validate required fields
✓ should validate email format (1 ms)
✓ should reject honeypot field
✓ should reject submission too fast
✓ should validate math captcha
✓ should handle Resend API error (1 ms)
✓ should handle JSON parsing error
✓ should accept valid submission with phone (1 ms)
✓ should accept valid submission with math captcha (1 ms)
✓ should handle submission after minimum time (1 ms)
PASS src/components/ui/back-button.test.tsx
BackButton
Rendering
✓ should render back button (8 ms)
✓ should render button text (5 ms)
✓ should render arrow icon (2 ms)
Interaction
✓ should call router.back() when clicked (2 ms)
Styling
✓ should have ghost variant (1 ms)
✓ should have small size (2 ms)
PASS src/lib/sentry.test.ts
sentry
initSentry
✓ should not initialize Sentry in non-production environment (1 ms)
✓ should not initialize Sentry when DSN is not set
✓ should initialize Sentry in production with DSN (20 ms)
✓ should handle missing NODE_ENV gracefully (1 ms)
PASS src/lib/utils.test.ts
utils
cn
✓ should merge class names correctly (2 ms)
✓ should handle conditional classes
✓ should handle empty input
formatNumber
✓ should format numbers with Chinese locale (4 ms)
✓ should handle decimal numbers
✓ should handle zero
formatCurrency
✓ should format numbers as CNY currency (1 ms)
✓ should handle large numbers
✓ should handle zero (1 ms)
debounce
✓ should delay function execution (2 ms)
✓ should cancel previous calls (1 ms)
throttle
✓ should limit function execution rate
randomBetween
✓ should generate number in range
✓ should handle negative numbers (1 ms)
lerp
✓ should interpolate between values
✓ should handle edge cases
clamp
✓ should clamp values within range
✓ should handle equal min and max
PASS src/lib/constants.test.ts
Constants
COMPANY_INFO
✓ should have company name (1 ms)
✓ should have short name
✓ should have slogan
✓ should have contact information
✓ should have legal information
NAVIGATION
✓ should be an array
✓ should have navigation items
✓ should have required properties (4 ms)
✓ should have home navigation
✓ should have contact navigation
STATS
✓ should be an array
✓ should have stat items (1 ms)
✓ should have required properties
✓ should have numeric values
SERVICES
✓ should be an array
✓ should have service items (1 ms)
✓ should have required properties (1 ms)
✓ should have software service
✓ should have cloud service
✓ should have data service
✓ should have security service
✓ should have features as array (1 ms)
✓ should have benefits as array
PRODUCTS
✓ should be an array
✓ should have product items
✓ should have required properties (1 ms)
✓ should have ERP product
✓ should have CRM product
✓ should have CMS product
✓ should have BI product
✓ should have pricing object
NEWS
✓ should be an array (1 ms)
✓ should have news items
✓ should have required properties
✓ should have valid categories (1 ms)
✓ should have valid date format (2 ms)
✓ should have founding news (1 ms)
PASS src/lib/auth.test.ts
Auth Module Configuration
Provider Configuration
✓ should export handlers (45 ms)
✓ should export signIn function
✓ should export signOut function
✓ should export auth function (1 ms)
Auth Options
✓ should have authOptions in handlers
✓ should have providers configured
✓ should have correct provider name
✓ should have email credential
✓ should have password credential
Page Configuration
✓ should have correct sign-in page
✓ should have correct error page (1 ms)
Session Configuration
✓ should use JWT session strategy
Callbacks
✓ should have jwt callback
✓ should have session callback
PASS src/lib/color-contrast.test.ts
color-contrast
calculateContrastRatio
✓ should calculate contrast ratio for black on white (1 ms)
✓ should calculate contrast ratio for white on black
✓ should calculate contrast ratio for gray on white
✓ should calculate contrast ratio for dark blue on white
✓ should calculate contrast ratio for same colors (1 ms)
✓ should handle lowercase hex
meetsWCAGStandard
AA level - normal text
✓ should pass for black on white
✓ should fail for light gray on white
✓ should pass for dark blue on white
AA level - large text
✓ should pass for gray on white
✓ should fail for light gray on white
AAA level - normal text
✓ should pass for black on white
✓ should pass for dark blue on white
AAA level - large text
✓ should pass for dark blue on white (1 ms)
✓ should pass for gray on white
default parameters
✓ should default to AA level
✓ should default to normal text size
result structure
✓ should return result with all required properties (1 ms)
PASS src/lib/audit.test.ts
audit
createAuditLog
✓ should create audit log successfully (1 ms)
✓ should handle missing optional fields
✓ should handle database errors gracefully (1 ms)
getActionLabel
✓ should return correct label for known actions (1 ms)
getActionColor
✓ should return correct color for known actions (2 ms)
PASS src/lib/colors.test.ts
colors
brandColors
✓ should have primary color palette (1 ms)
✓ should have brand color palette
✓ should have neutral color palette
✓ should have success color palette
✓ should have warning color palette (1 ms)
✓ should have info color palette (1 ms)
✓ should have error color palette (1 ms)
✓ should have valid hex color format (1 ms)
colorValues
✓ should have primary colors
✓ should have brand colors
✓ should have text colors (1 ms)
✓ should have background colors
✓ should have border colors
✓ should have link colors
✓ should have status colors (1 ms)
✓ should have valid hex color format
gradients
✓ should have primary gradient (1 ms)
✓ should have hero gradient (1 ms)
✓ should have brand gradient
✓ should have subtle gradient
✓ should have card gradient
✓ should have cta gradient (1 ms)
✓ should have valid gradient format
Type Exports
✓ should export BrandColor type
✓ should export ColorValue type
✓ should export Gradient type (1 ms)
PASS src/db/queries.test.ts
database queries
user queries
✓ should query user by id (1 ms)
✓ should query user by email
✓ should return null for non-existent user (1 ms)
✓ should query users by role
content queries
✓ should query content by id
✓ should query content by slug (1 ms)
✓ should query published content (1 ms)
✓ should query content by type (1 ms)
✓ should query content with multiple conditions
site config queries
✓ should query config by key (1 ms)
✓ should query config by category
✓ should return null for non-existent config
query ordering
✓ should order content by created date (1 ms)
PASS src/lib/gradients.test.ts
gradients
getGradientStyle
✓ should return primary gradient style
✓ should return hero gradient style
✓ should return brand gradient style (1 ms)
✓ should return subtle gradient style
✓ should return card gradient style
✓ should return cta gradient style
getGlowStyle
✓ should return primary glow style with default opacity (1 ms)
✓ should return brand glow style with default opacity
✓ should return glow style with custom opacity
✓ should return glow style with zero opacity
✓ should return glow style with full opacity
getBorderGradientStyle
✓ should return border gradient style (1 ms)
getTextGradientStyle
✓ should return primary text gradient style
✓ should return brand text gradient style
✓ should default to primary gradient
getHeroGradientStyle
✓ should return hero gradient style (1 ms)
getCTAGradientStyle
✓ should return CTA gradient style (1 ms)
PASS src/lib/analytics.test.ts
analytics
pageview
✓ should be defined
✓ should be callable
event
✓ should be defined
✓ should be callable with all parameters
✓ should be callable with minimal parameters (1 ms)
trackContactForm
✓ should be defined
✓ should be callable
trackButtonClick
✓ should be defined (1 ms)
✓ should be callable (1 ms)
trackPageView
✓ should be defined
✓ should be callable (1 ms)
PASS src/app/api/auth/[...nextauth]/route.test.ts
/api/auth/[...nextauth]
GET handler
✓ should export GET handler (1 ms)
✓ should call auth GET handler
POST handler
✓ should export POST handler (1 ms)
✓ should call auth POST handler
PASS src/lib/sanitize.test.ts
sanitize
sanitizeHTML
✓ should allow safe HTML tags (8 ms)
✓ should remove dangerous tags (2 ms)
✓ should remove dangerous attributes (3 ms)
✓ should handle empty input (1 ms)
sanitizeInput
✓ should remove all HTML tags (2 ms)
✓ should handle special characters (1 ms)
sanitizeURL
✓ should allow valid http URLs (1 ms)
✓ should allow valid https URLs
✓ should allow mailto URLs (5 ms)
✓ should reject javascript URLs (1 ms)
✓ should reject data URLs (2 ms)
escapeHTML
✓ should escape HTML special characters (1 ms)
✓ should handle mixed content
✓ should handle empty string (1 ms)
PASS src/lib/auth/permissions.test.ts
permissions
PERMISSIONS constant
✓ should have admin permissions (1 ms)
✓ should have editor permissions (1 ms)
✓ should have viewer permissions
✓ should have config permissions
✓ should have users permissions
✓ should have logs permissions (1 ms)
hasPermission
admin role
✓ should allow all content actions (1 ms)
✓ should allow config actions
✓ should allow all users actions
✓ should allow logs read
editor role
✓ should allow content actions except delete (1 ms)
✓ should allow config read only
✓ should not allow users actions
✓ should allow logs read (1 ms)
viewer role
✓ should only allow content read
✓ should allow config read only
✓ should not allow users actions
✓ should not allow logs actions
edge cases
✓ should return false for invalid role (1 ms)
✓ should return false for invalid resource
✓ should return false for invalid action
✓ should handle null role
✓ should handle undefined resource
✓ should handle empty action string (1 ms)
✓ should handle case sensitivity for roles (1 ms)
✓ should handle case sensitivity for resources
✓ should handle case sensitivity for actions
✓ should handle undefined role
✓ should handle numeric role
✓ should handle object role
Type Exports
✓ should export Role type
✓ should export Resource type
✓ should export Action type
PASS src/lib/csrf.test.ts
csrf
generateCSRFToken
✓ should generate a token of correct length (1 ms)
✓ should generate unique tokens
✓ should only contain hexadecimal characters (1 ms)
validateCSRFToken
✓ should return true for matching tokens
✓ should return false for mismatched tokens
✓ should return false for empty tokens
getCSRFTokenFromStorage
✓ should return token from sessionStorage
✓ should return null when token not found
setCSRFTokenToStorage
✓ should set token in sessionStorage
Test Suites: 62 passed, 62 total
Tests: 1073 passed, 1073 total
Snapshots: 0 total
Time: 4.7 s, estimated 5 s
Ran all test suites.