Files
novalon-website/test-reports/coverage-report.txt
T

1814 lines
86 KiB
Plaintext

> ruixin-website-react@0.1.0 test:unit
> jest --coverage --coverageReporters=json --coverageReporters=text
PASS src/lib/animations.test.tsx
Animation Variants
inkVariants
✓ should have correct hidden state (1303 ms)
✓ should have correct visible state (2 ms)
✓ should have correct transition configuration (1 ms)
sealStampVariants
✓ should have correct hidden state (1 ms)
✓ should have correct visible state (1 ms)
✓ should use spring animation
brushStrokeVariants
✓ should have correct hidden state (1 ms)
✓ should have correct visible state (1 ms)
fadeUpVariants
✓ should have correct hidden state (1 ms)
✓ should have correct visible state (1 ms)
staggerContainerVariants
✓ should have staggerChildren configured (2 ms)
staggerItemVariants
✓ should have correct hidden state (8 ms)
✓ should have correct visible state
Animation Components
InkReveal
✓ should render children correctly (60 ms)
✓ should apply custom className (10 ms)
✓ should use inkVariants (8 ms)
SealStamp
✓ should render children correctly (7 ms)
✓ should apply custom className (33 ms)
FadeUp
✓ should render children correctly (4 ms)
✓ should apply custom duration (5 ms)
✓ should apply delay prop (3 ms)
StaggerContainer
✓ should render children correctly (27 ms)
✓ should apply custom staggerDelay (5 ms)
StaggerItem
✓ should render children correctly (3 ms)
RippleButton
✓ should render children correctly (6 ms)
✓ should handle click events (36 ms)
✓ should apply custom className (3 ms)
InkCard
✓ should render children correctly (2 ms)
✓ should apply custom hoverScale (6 ms)
CountUp
✓ should render with prefix and suffix (7 ms)
✓ should apply custom className (4 ms)
Typewriter
✓ should render component correctly (17 ms)
✓ should apply custom className (7 ms)
FloatingElement
✓ should render children correctly (2 ms)
✓ should apply custom amplitude (8 ms)
PulseElement
✓ should render children correctly (3 ms)
✓ should apply custom scale (4 ms)
GradientText
✓ should render children correctly (76 ms)
✓ should apply custom colors (77 ms)
SplitText
✓ should render text correctly (6 ms)
✓ should apply custom className (4 ms)
GlitchText
✓ should render text correctly (3 ms)
✓ should apply custom className (3 ms)
MagneticButton
✓ should render children correctly (2 ms)
✓ should handle click events (2 ms)
BlurReveal
✓ should render children correctly (2 ms)
✓ should apply custom className (1 ms)
WaveText
✓ should render text correctly (6 ms)
ShimmerButton
✓ should render children correctly (5 ms)
✓ should handle click events (3 ms)
Animation Hooks
useParallax
✓ should be defined
useSmoothSpring
✓ should be defined
SVG Components
InkDropSVG
✓ should render SVG correctly (4 ms)
✓ should apply custom className (2 ms)
InkSplash
✓ should render SVG correctly (2 ms)
✓ should apply custom color (1 ms)
✓ should apply custom size (2 ms)
PASS src/components/ui/sheet.test.tsx
Sheet
Rendering
✓ should render sheet trigger (169 ms)
✓ should render sheet content when open (318 ms)
✓ should render sheet title (75 ms)
✓ should render sheet description (31 ms)
✓ should render sheet footer (60 ms)
Interaction
✓ should open sheet on trigger click (24 ms)
✓ should close sheet on close button click (64 ms)
Sides
✓ should render right side by default (29 ms)
✓ should render left side (70 ms)
✓ should render top side (73 ms)
✓ should render bottom side (38 ms)
Styling
✓ should apply custom className to content (28 ms)
✓ should apply custom className to header (83 ms)
✓ should apply custom className to footer (24 ms)
Close Button
✓ should show close button by default (23 ms)
✓ should hide close button when showCloseButton is false (183 ms)
PASS src/db/mutations.test.ts
database mutations
user mutations
✓ should insert new user (2 ms)
✓ should update user (1 ms)
✓ should delete user (1 ms)
content mutations
✓ should insert new content
✓ should update content (1 ms)
✓ should delete content
✓ should publish content
site config mutations
✓ should insert new config (1 ms)
✓ should update config
✓ should upsert config
batch operations
✓ should insert multiple users (1 ms)
✓ should insert multiple content items
error handling
✓ should handle duplicate key error (12 ms)
✓ should handle foreign key constraint error (77 ms)
PASS src/components/sections/contact-section.test.tsx
ContactSection
Rendering
✓ should render contact section (315 ms)
✓ should render contact form (39 ms)
✓ should render submit button (177 ms)
✓ should render company contact information (40 ms)
✓ should render work hours card (30 ms)
Form Validation
✓ should show error for invalid name (171 ms)
✓ should show error for invalid phone (195 ms)
✓ should show error for invalid email (467 ms)
✓ should show error for short message (113 ms)
Accessibility
✓ should have proper form labels (68 ms)
✓ should have proper ARIA attributes (82 ms)
CSRF Protection
✓ should generate CSRF token on mount (24 ms)
PASS src/components/layout/mobile-tab-bar.test.tsx
MobileTabBar
Rendering
✓ should render tab bar (100 ms)
✓ should render all tabs (49 ms)
✓ should render tab icons (46 ms)
Active State
✓ should highlight active tab (84 ms)
✓ should show active indicator (19 ms)
Navigation Links
✓ should have correct href for home (11 ms)
✓ should have correct href for services (10 ms)
✓ should have correct href for products (6 ms)
✓ should have correct href for news (12 ms)
✓ should have correct href for contact (9 ms)
Accessibility
✓ should have navigation role (33 ms)
✓ should have accessible tab labels (36 ms)
Styling
✓ should have fixed positioning (26 ms)
✓ should have responsive visibility (16 ms)
✓ should have backdrop blur (31 ms)
✓ should have proper height (22 ms)
PASS src/components/layout/mobile-menu.test.tsx
MobileMenu
Rendering
✓ should render menu button (71 ms)
✓ should render menu icon when closed (13 ms)
✓ should not render menu panel when closed (6 ms)
Opening Menu
✓ should open menu when button clicked (21 ms)
✓ should change button label when open (37 ms)
✓ should render navigation items (58 ms)
Closing Menu
✓ should close menu when button clicked again (27 ms)
✓ should close menu when overlay clicked (43 ms)
Keyboard Navigation
✓ should open menu with Enter key (35 ms)
✓ should open menu with Space key (32 ms)
✓ should close menu with Escape key (21 ms)
Accessibility
✓ should have aria-expanded attribute (5 ms)
✓ should update aria-expanded when open (15 ms)
✓ should have aria-controls attribute (4 ms)
✓ should have navigation role (5 ms)
Styling
✓ should have responsive visibility (3 ms)
✓ should apply custom className (4 ms)
PASS src/components/sections/products-section.test.tsx (5.072 s)
ProductsSection
Rendering
✓ should render products section (174 ms)
✓ should render section heading (233 ms)
✓ should render section description (84 ms)
Product Cards
✓ should render product cards (66 ms)
✓ should display products in grid layout (170 ms)
✓ should render product categories (40 ms)
✓ should render product features (172 ms)
Custom Solution Section
✓ should render custom solution section (84 ms)
✓ should render custom solution description (39 ms)
✓ should render contact button (311 ms)
✓ should link to contact page (218 ms)
Accessibility
✓ should have region role (84 ms)
✓ should have aria-labelledby attribute (43 ms)
✓ should have accessible heading (64 ms)
Styling
✓ should have background color (54 ms)
✓ should have proper padding (20 ms)
✓ should have decorative background elements (84 ms)
PASS src/components/ui/animated-card.test.tsx
Animated Cards
InkCard
✓ should render ink card (93 ms)
✓ should apply custom className (3 ms)
✓ should handle mouse move (5 ms)
✓ should handle hover events (4 ms)
GeometricCard
✓ should render geometric card (3 ms)
✓ should apply custom className (1 ms)
✓ should have corner decorations (1 ms)
FlipCard
✓ should render flip card (2 ms)
✓ should flip on click (3 ms)
✓ should apply custom className (2 ms)
TiltCard
✓ should render tilt card (7 ms)
✓ should apply custom className (2 ms)
✓ should handle mouse move (3 ms)
✓ should handle mouse leave (17 ms)
GlowCard
✓ should render glow card (54 ms)
✓ should apply custom className (2 ms)
✓ should handle mouse move (46 ms)
ExpandCard
✓ should render expand card (10 ms)
✓ should apply custom className (6 ms)
✓ should expand on click (16 ms)
PASS src/components/ui/input.test.tsx
Input
Rendering
✓ should render input element (13 ms)
✓ should render with label (8 ms)
✓ should render required indicator when required (19 ms)
✓ should render error message (7 ms)
✓ should render with placeholder (13 ms)
✓ should render with custom data-testid (2 ms)
Types
✓ should render text input by default (11 ms)
✓ should render email input (6 ms)
✓ should render password input (14 ms)
✓ should render tel input (8 ms)
User Interaction
✓ should handle user input (55 ms)
✓ should handle onChange event (23 ms)
✓ should handle onBlur event (56 ms)
✓ should handle onFocus event (13 ms)
Disabled State
✓ should be disabled when disabled prop is true (10 ms)
✓ should not accept input when disabled (3 ms)
Accessibility
✓ should have aria-required when required (4 ms)
✓ should have aria-invalid when error exists (9 ms)
✓ should have aria-describedby when error exists (8 ms)
✓ should have proper label association (2 ms)
✓ should have role="alert" on error message (4 ms)
Custom Styling
✓ should apply custom className (10 ms)
✓ should have error styling when error exists (3 ms)
Ref Forwarding
✓ should forward ref to input element (12 ms)
PASS src/components/sections/cases-section.test.tsx
CasesSection
Rendering
✓ should render cases section (34 ms)
✓ should render section heading (30 ms)
✓ should render section description (46 ms)
✓ should render case cards (11 ms)
✓ should render client names (11 ms)
✓ should render industry badges (29 ms)
✓ should render results (17 ms)
✓ should render view more button (14 ms)
Accessibility
✓ should have section id (43 ms)
✓ should have region role (19 ms)
✓ should have aria-labelledby (37 ms)
Styling
✓ should have correct background (38 ms)
✓ should have container (19 ms)
PASS src/components/ui/dropdown-menu.test.tsx
DropdownMenu
Rendering
✓ should render dropdown menu trigger (65 ms)
✓ should render menu items (158 ms)
✓ should render menu label (78 ms)
✓ should render separator (78 ms)
Interaction
✓ should open menu on trigger click (6 ms)
✓ should close menu on item click (112 ms)
DropdownMenuShortcut
✓ should render shortcut text (57 ms)
Styling
✓ should apply custom className to trigger (4 ms)
✓ should apply custom className to content (85 ms)
✓ should apply custom className to item (60 ms)
PASS src/components/ui/dialog.test.tsx
Dialog Components
Dialog
✓ should render dialog root (3 ms)
DialogTrigger
✓ should render trigger button (5 ms)
DialogContent
✓ should render content with children (6 ms)
✓ should apply custom className (2 ms)
DialogHeader
✓ should render header with children (1 ms)
✓ should apply custom className
DialogFooter
✓ should render footer with children (1 ms)
✓ should apply custom className (1 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 (10 ms)
Dialog Composition
✓ should render complete dialog structure (11 ms)
Accessibility
✓ should have accessible title (3 ms)
✓ should support custom ARIA attributes (3 ms)
PASS src/components/sections/news-section.test.tsx
NewsSection
Rendering
✓ should render news section (72 ms)
✓ should render section heading (64 ms)
✓ should render section description (34 ms)
News Cards
✓ should render news cards (15 ms)
✓ should display news in grid layout (20 ms)
✓ should render news categories (32 ms)
✓ should render news dates (30 ms)
Call to Action
✓ should render view all news link (22 ms)
✓ should link to news page (19 ms)
✓ should render read more links (12 ms)
Accessibility
✓ should have region role (18 ms)
✓ should have aria-labelledby attribute (10 ms)
✓ should have accessible heading (11 ms)
Styling
✓ should have background color (6 ms)
✓ should have proper padding (11 ms)
✓ should have container styling (9 ms)
PASS src/components/layout/footer.test.tsx
Footer
Rendering
✓ should render footer component (24 ms)
✓ should render logo (13 ms)
✓ should render company description (14 ms)
✓ should render quick links section (8 ms)
✓ should render service items section (8 ms)
✓ should render contact information section (8 ms)
✓ should render navigation links (10 ms)
✓ should render service links (13 ms)
✓ should render contact details (18 ms)
Icons
✓ should render contact icons (6 ms)
Legal Links
✓ should render privacy policy link (11 ms)
✓ should render terms of service link (11 ms)
✓ should render ICP filing info (8 ms)
✓ should render police filing info (12 ms)
Copyright
✓ should render copyright with current year (10 ms)
✓ should render company name in copyright (13 ms)
Accessibility
✓ should have proper role attribute (24 ms)
✓ should have proper link hrefs (12 ms)
QR Code Section
✓ should render QR code image (6 ms)
✓ should render QR code description (11 ms)
PASS src/components/ui/textarea.test.tsx
Textarea
Rendering
✓ should render textarea element (29 ms)
✓ should render with label (9 ms)
✓ should render required indicator when required (8 ms)
✓ should render error message (7 ms)
✓ should render with placeholder (2 ms)
✓ should render with custom data-testid (2 ms)
✓ should render with default rows (7 ms)
User Interaction
✓ should handle user input (179 ms)
✓ should handle onChange event (25 ms)
✓ should handle onBlur event (29 ms)
✓ should handle onFocus event (22 ms)
✓ should handle multiline input (63 ms)
Disabled State
✓ should be disabled when disabled prop is true (5 ms)
✓ should not accept input when disabled (7 ms)
Accessibility
✓ should have aria-required when required (9 ms)
✓ should have aria-invalid when error exists (5 ms)
✓ should have aria-describedby when error exists (3 ms)
✓ should have proper label association (2 ms)
✓ should have role="alert" on error message (5 ms)
Custom Styling
✓ should apply custom className (7 ms)
✓ should have error styling when error exists (5 ms)
Ref Forwarding
✓ should forward ref to textarea element (2 ms)
Value Handling
✓ should display controlled value (6 ms)
✓ should display defaultValue (17 ms)
MaxLength
✓ should respect maxLength attribute (7 ms)
PASS src/app/api/contact/route.test.ts
/api/contact
✓ should handle POST request with valid data (21 ms)
✓ should validate required fields (1 ms)
✓ should validate email format (1 ms)
✓ should reject honeypot field (1 ms)
✓ should reject submission too fast (1 ms)
✓ should validate math captcha
✓ should handle Resend API error (1 ms)
✓ should handle JSON parsing error (1 ms)
✓ should accept valid submission with phone (1 ms)
✓ should accept valid submission with math captcha
✓ should handle submission after minimum time
PASS src/components/ui/toast.test.tsx
Toast Component
Rendering
✓ should render toast with message (8 ms)
✓ should render with success type by default (12 ms)
✓ should render with error type (5 ms)
✓ should render with info type (8 ms)
✓ should render close button (7 ms)
Auto-close
✓ should auto-close after default duration (3000ms) (73 ms)
✓ should auto-close after custom duration (36 ms)
✓ should cleanup timer on unmount (6 ms)
Manual Close
✓ should close when close button clicked (16 ms)
Accessibility
✓ should have alert role (8 ms)
✓ should have aria-live attribute (11 ms)
✓ should have accessible close button (4 ms)
Data Attributes
✓ should support custom data-testid (4 ms)
Icons
✓ should render success icon for success type (6 ms)
✓ should render error icon for error type (6 ms)
✓ should render info icon for info type (7 ms)
Styling
✓ should apply success background color (6 ms)
✓ should apply error background color (8 ms)
✓ should apply info background color (10 ms)
PASS src/components/ui/error-boundary.test.tsx
ErrorBoundary
Normal Rendering
✓ should render children when no error (6 ms)
✓ should not show error UI when no error (2 ms)
Error Handling
✓ should catch errors and display fallback UI (22 ms)
✓ should display default error message (4 ms)
✓ should display custom fallback if provided (4 ms)
✓ should log error to console (17 ms)
Error Recovery
✓ should have retry button (24 ms)
Accessibility
✓ should have accessible error icon (3 ms)
✓ should have accessible retry button (5 ms)
Styling
✓ should have centered layout (4 ms)
✓ should have error icon with red background (4 ms)
✓ should have styled retry button (5 ms)
PASS src/components/ui/button.test.tsx
Button Component
Rendering
✓ should render button with text (12 ms)
✓ should render as a button element by default (4 ms)
✓ should apply default variant styles (3 ms)
Variants
✓ should apply secondary variant styles (2 ms)
✓ should apply outline variant styles (4 ms)
✓ should apply ghost variant styles (4 ms)
✓ should apply link variant styles (5 ms)
✓ should apply destructive variant styles (3 ms)
Sizes
✓ should apply default size styles (4 ms)
✓ should apply small size styles (10 ms)
✓ should apply large size styles (3 ms)
✓ should apply icon size styles (4 ms)
Accessibility
✓ should be focusable (7 ms)
✓ should have proper disabled state (10 ms)
✓ should have focus visible styles (3 ms)
Custom Props
✓ should apply custom className (3 ms)
✓ should pass through additional props (14 ms)
✓ should handle click events (4 ms)
Touch Support
✓ should have touch manipulation (2 ms)
✓ should have minimum touch target size (3 ms)
PASS src/components/sections/services-section.test.tsx
ServicesSection
Rendering
✓ should render services section (28 ms)
✓ should render section heading (56 ms)
✓ should render section description (23 ms)
Service Cards
✓ should render service cards (16 ms)
✓ should display services in grid layout (17 ms)
✓ should render service icons (12 ms)
Call to Action
✓ should render view all services button (72 ms)
✓ should link to services page (33 ms)
Accessibility
✓ should have section with id (15 ms)
✓ should have aria-labelledby attribute (14 ms)
✓ should have accessible heading (36 ms)
Styling
✓ should have white background (7 ms)
✓ should have proper padding (24 ms)
✓ should have decorative background elements (20 ms)
PASS src/lib/auth/permissions.test.ts
permissions
PERMISSIONS constant
✓ should have admin permissions (3 ms)
✓ should have editor permissions (1 ms)
✓ should have viewer permissions (1 ms)
✓ should have config permissions
✓ should have users permissions (1 ms)
✓ should have logs permissions
hasPermission
admin role
✓ should allow all content actions
✓ should allow config actions (1 ms)
✓ should allow all users actions
✓ should allow logs read
editor role
✓ should allow content actions except delete (1 ms)
✓ should allow config read only (1 ms)
✓ should not allow users actions
✓ should allow logs read
viewer role
✓ should only allow content read (1 ms)
✓ should allow config read only (1 ms)
✓ should not allow users actions
✓ should not allow logs actions (1 ms)
edge cases
✓ should return false for invalid role
✓ should return false for invalid resource (5 ms)
✓ should return false for invalid action (1 ms)
✓ should handle null role
✓ should handle undefined resource
✓ should handle empty action string
✓ should handle case sensitivity for roles
✓ 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 (1 ms)
✓ should export Resource type
✓ should export Action type
PASS src/components/sections/about-section.test.tsx
AboutSection
Rendering
✓ should render about section (33 ms)
✓ should render section heading (68 ms)
✓ should render company slogan (32 ms)
✓ should render company mission (26 ms)
Statistics
✓ should render statistics cards (10 ms)
✓ should display statistics in grid layout (33 ms)
Call to Action
✓ should render learn more button (32 ms)
✓ should link to about page (27 ms)
Accessibility
✓ should have region role (13 ms)
✓ should have aria-labelledby attribute (7 ms)
✓ should have accessible heading (15 ms)
Styling
✓ should have background color (6 ms)
✓ should have proper padding (7 ms)
✓ should have decorative background pattern (7 ms)
PASS src/lib/auth/session.test.ts
session management
createSession
✓ should create session with user data (1 ms)
✓ should create session with createdAt timestamp (1 ms)
✓ should create session with 24 hour expiration
✓ should create session without optional role (1 ms)
isSessionValid
✓ should return true for valid session
✓ should return false for expired session
✓ should return false for session with zero expiration time (1 ms)
✓ should return true for session with 1ms remaining (5 ms)
getSessionAge
✓ should return age of session in milliseconds
✓ should increase over time (13 ms)
getSessionTimeRemaining
✓ should return positive time for valid session
✓ should return approximately 24 hours for new session (1 ms)
✓ 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 (1 ms)
✓ 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
session lifecycle
✓ should track session from creation to expiration (154 ms)
✓ should have consistent age and time remaining
session data integrity
✓ should maintain session data immutability (1 ms)
✓ should handle empty role gracefully (1 ms)
✓ should handle special characters in userId
PASS src/components/ui/card.test.tsx
Card Components
Card
✓ should render card with children (35 ms)
✓ should have proper data-slot attribute (17 ms)
✓ should apply default styles (4 ms)
✓ should apply custom className (3 ms)
✓ should have hover effects (2 ms)
CardHeader
✓ should render header with children (4 ms)
✓ should have proper data-slot attribute (1 ms)
✓ should apply default styles (2 ms)
CardTitle
✓ should render title text (1 ms)
✓ should have proper data-slot attribute (5 ms)
✓ should apply default styles (9 ms)
CardDescription
✓ should render description text (2 ms)
✓ should have proper data-slot attribute (2 ms)
✓ should apply default styles (2 ms)
CardAction
✓ should render action content (2 ms)
✓ should have proper data-slot attribute (1 ms)
✓ should apply default styles (2 ms)
CardContent
✓ should render content (2 ms)
✓ should have proper data-slot attribute (2 ms)
✓ should apply default styles (2 ms)
CardFooter
✓ should render footer content (2 ms)
✓ should have proper data-slot attribute (1 ms)
✓ should apply default styles (1 ms)
Card Composition
✓ should render complete card structure (10 ms)
✓ should allow nested components (3 ms)
Accessibility
✓ should be accessible as a div element (1 ms)
✓ should support custom ARIA attributes (11 ms)
PASS src/components/ui/touch-button.test.tsx
TouchButton
Rendering
✓ should render button with text (6 ms)
✓ should render button element (113 ms)
✓ should apply custom className (2 ms)
Variants
✓ should render primary variant by default (1 ms)
✓ should render secondary variant (3 ms)
✓ should render ghost variant (1 ms)
Sizes
✓ should render small size (2 ms)
✓ should render medium size by default (8 ms)
✓ should render large size (3 ms)
Full Width
✓ should not be full width by default (1 ms)
✓ should be full width when fullWidth is true (4 ms)
Disabled State
✓ should not be disabled by default (4 ms)
✓ should be disabled when disabled prop is true (19 ms)
Touch Events
✓ should handle touch start (4 ms)
✓ should handle touch end (4 ms)
✓ should handle touch cancel (2 ms)
Click Events
✓ should handle click events (39 ms)
PASS src/lib/upload.test.ts
Upload Module
getFileExtension
✓ should return correct extension for JPEG (193 ms)
✓ should return correct extension for PNG
✓ should return correct extension for PDF (1 ms)
✓ should return empty string for unknown MIME type (1 ms)
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 (1 ms)
✓ should handle undefined type
✓ should handle empty string type
✓ should handle invalid category (1 ms)
validateFileSignature
✓ should validate JPEG signature correctly
✓ should validate PNG signature correctly
✓ should validate PDF signature correctly (2 ms)
✓ should return false for invalid JPEG signature
✓ should return true for SVG files
✓ should return true for unknown MIME types (1 ms)
sanitizeFileName
✓ should remove special characters
✓ should convert to lowercase (1 ms)
✓ should replace multiple dots
✓ should preserve Chinese characters (1 ms)
✓ 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 (1 ms)
✓ 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 (3 ms)
✓ should pad month and day with zeros
uploadFile
✓ should upload a valid image file successfully (1 ms)
✓ should reject files exceeding size limit (77 ms)
✓ should reject disallowed file types (1 ms)
✓ should reject dangerous file extensions (1 ms)
✓ should reject files with mismatched signatures (2 ms)
✓ should create upload directory if it does not exist (1 ms)
✓ should include userId in upload result (2 ms)
✓ should sanitize file name
deleteFile
✓ should delete existing file successfully (2 ms)
✓ should return false for non-existent file (1 ms)
✓ 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 (1 ms)
✓ should prevent double extension attacks
✓ should validate file signatures to prevent MIME type spoofing (1 ms)
✓ should reject all dangerous file extensions (1 ms)
PASS src/app/api/auth/[...nextauth]/route.test.ts
/api/auth/[...nextauth]
GET handler
✓ should export GET handler (2 ms)
✓ should call auth GET handler (1 ms)
POST handler
✓ should export POST handler
✓ should call auth POST handler (1 ms)
PASS src/components/sections/hero-section.test.tsx
HeroSection
Rendering
✓ should render hero section (61 ms)
✓ should render company name (41 ms)
✓ should render features (48 ms)
Statistics
✓ should render statistics section (99 ms)
Accessibility
✓ should have proper ARIA labels (23 ms)
✓ should have accessible buttons (37 ms)
PASS src/components/ui/insight-card.test.tsx
InsightCard
Rendering
✓ should render insight card (32 ms)
✓ should render title (82 ms)
✓ should render excerpt (8 ms)
✓ should render category badge (5 ms)
✓ should render read time (26 ms)
✓ should render published date (6 ms)
✓ should render read more link (2 ms)
Image
✓ should render image when imageUrl is provided (3 ms)
✓ should not render image when imageUrl is not provided (5 ms)
Featured
✓ should not be featured by default (5 ms)
✓ should be featured when featured prop is true (15 ms)
Styling
✓ should have article element (4 ms)
✓ should have border class (11 ms)
✓ should have rounded class (5 ms)
PASS src/components/layout/header.test.tsx
Header
Rendering
✓ should render header component (30 ms)
✓ should render logo (6 ms)
✓ should render desktop navigation (4 ms)
✓ should render navigation items (91 ms)
✓ should render consult button (13 ms)
✓ should render mobile menu button (14 ms)
Mobile Menu
✓ should toggle mobile menu on button click (89 ms)
✓ should show X icon when menu is open (29 ms)
✓ should show Menu icon when menu is closed (5 ms)
Accessibility
✓ should have proper ARIA attributes on menu button (6 ms)
✓ should update aria-expanded when menu is toggled (32 ms)
✓ should have proper navigation role (5 ms)
Navigation
✓ should have correct href for navigation items (5 ms)
PASS src/lib/email-templates.test.ts
Email Templates
generateNotificationEmail
✓ should generate valid HTML email (67 ms)
✓ should include customer name (17 ms)
✓ should include customer phone (1 ms)
✓ should include customer email (1 ms)
✓ should include message content (1 ms)
✓ should include company name (1 ms)
✓ should include submit time (1 ms)
✓ should include mailto link
✓ should include company address in footer (2 ms)
✓ should have proper email title (2 ms)
✓ should include responsive meta tag (1 ms)
✓ should include UTF-8 charset (5 ms)
✓ should handle long messages (2 ms)
✓ should handle special characters in name
✓ should handle special characters in message (1 ms)
generateConfirmationEmail
✓ should generate valid HTML email (1 ms)
✓ should include customer name
✓ should include message content (1 ms)
✓ should include company name (5 ms)
✓ should include company contact information (1 ms)
✓ 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 (1 ms)
✓ should handle special characters in name
Email Template Structure
✓ should have consistent styling in notification email
✓ should have consistent styling in confirmation email
✓ should use brand colors in notification email (1 ms)
✓ should use brand colors in confirmation email
✓ should have proper container structure in notification email
✓ should have proper container structure in confirmation email (1 ms)
Edge Cases
✓ should handle empty message
✓ should handle empty name
✓ should handle email with special characters
✓ should handle phone number with spaces (1 ms)
✓ should handle unicode characters in message
Performance Tests
✓ should generate notification email quickly (9 ms)
✓ should generate confirmation email quickly (2 ms)
PASS src/db/queries.test.ts
database queries
user queries
✓ should query user by id (2 ms)
✓ should query user by email (1 ms)
✓ should return null for non-existent user
✓ should query users by role (1 ms)
content queries
✓ should query content by id
✓ should query content by slug (1 ms)
✓ should query published content (6 ms)
✓ should query content by type
✓ should query content with multiple conditions (2 ms)
site config queries
✓ should query config by key (1 ms)
✓ should query config by category
✓ should return null for non-existent config (1 ms)
query ordering
✓ should order content by created date (1 ms)
PASS src/components/sections/insights-section.test.tsx
InsightsSection
Rendering
✓ should render insights section (41 ms)
✓ should render section heading (32 ms)
✓ should render section description (25 ms)
✓ should render insight cards (21 ms)
✓ should render insight titles (6 ms)
✓ should render insight categories (7 ms)
✓ should render view all button (4 ms)
Accessibility
✓ should have section id (15 ms)
Styling
✓ should have correct background (22 ms)
✓ should have container (17 ms)
✓ should have grid layout (11 ms)
PASS src/components/sections/testimonials-section.test.tsx
TestimonialsSection
Rendering
✓ should render testimonials section (39 ms)
✓ should render section heading (40 ms)
✓ should render section description (5 ms)
✓ should render testimonial cards (5 ms)
✓ should render testimonial authors (5 ms)
✓ should render testimonial quotes (20 ms)
Accessibility
✓ should have section id (11 ms)
Styling
✓ should have correct background (4 ms)
✓ should have container (3 ms)
✓ should have grid layout (18 ms)
PASS src/components/ui/back-button.test.tsx
BackButton
Rendering
✓ should render back button (10 ms)
✓ should render button text (3 ms)
✓ should render arrow icon (3 ms)
Interaction
✓ should call router.back() when clicked (7 ms)
Styling
✓ should have ghost variant (3 ms)
✓ should have small size (2 ms)
PASS src/components/ui/optimized-image.test.tsx
OptimizedImage
Rendering
✓ should render optimized image (31 ms)
✓ should render with alt text (32 ms)
✓ should apply custom className (4 ms)
✓ should apply container className (2 ms)
Loading States
✓ should handle onLoad event (3 ms)
✓ should handle onError event (7 ms)
✓ should show error state on error (20 ms)
Object Fit
✓ should apply cover object fit by default (3 ms)
✓ should apply contain object fit (3 ms)
✓ should apply fill object fit (6 ms)
✓ should apply none object fit (8 ms)
✓ should apply scale-down object fit (6 ms)
Fill Mode
✓ should render in fill mode (3 ms)
Priority
✓ should handle priority prop (1 ms)
PASS src/components/ui/testimonial-card.test.tsx
TestimonialCard
Rendering
✓ should render testimonial card (12 ms)
✓ should render author name (5 ms)
✓ should render position and company (4 ms)
✓ should render quote with quotes (3 ms)
Rating
✓ should render 5 stars by default (9 ms)
✓ should render custom rating (4 ms)
✓ should not render stars when rating is 0 (3 ms)
Avatar
✓ should render avatar when avatarUrl is provided (2 ms)
✓ should not render avatar when avatarUrl is not provided (6 ms)
Styling
✓ should have correct card classes (12 ms)
✓ should have border class (7 ms)
✓ should have background class (13 ms)
PASS src/components/ui/page-header.test.tsx
PageHeader
Rendering
✓ should render page header (8 ms)
✓ should render title (1 ms)
✓ should render description when provided (1 ms)
✓ should not render description when not provided (13 ms)
✓ should render badge when provided (23 ms)
✓ should not render badge when not provided (2 ms)
Effects
✓ should render ink background (2 ms)
✓ should render data particle flow (3 ms)
✓ should render subtle dots (1 ms)
Styling
✓ should have container class (3 ms)
✓ should apply custom className (5 ms)
PASS src/components/ui/glass-card.test.tsx
GlassCard
Rendering
✓ should render glass card (18 ms)
✓ should render children (4 ms)
✓ should apply custom className (3 ms)
Variants
✓ should render default variant (14 ms)
✓ should render elevated variant (1 ms)
✓ should render outline variant (3 ms)
✓ should render glow variant (2 ms)
Styling
✓ should have rounded class (1 ms)
✓ should have border class
✓ should have backdrop-blur class
Forward Ref
✓ should forward ref (2 ms)
PASS src/components/ui/loading-skeleton.test.tsx
Loading Skeleton Components
Skeleton
✓ should render skeleton element (39 ms)
✓ should apply default styles (1 ms)
✓ should apply custom className (13 ms)
CardSkeleton
✓ should render card skeleton (53 ms)
✓ should have correct structure (2 ms)
ServiceCardSkeleton
✓ should render service card skeleton (3 ms)
✓ should have full height (5 ms)
CaseCardSkeleton
✓ should render case card skeleton (2 ms)
✓ should have image placeholder (1 ms)
ProductCardSkeleton
✓ should render product card skeleton (4 ms)
✓ should have flex column layout (5 ms)
NewsCardSkeleton
✓ should render news card skeleton (3 ms)
✓ should have image placeholder (1 ms)
SectionSkeleton
✓ should render section skeleton (6 ms)
✓ should render multiple service card skeletons (5 ms)
Accessibility
✓ should not have any accessible content (4 ms)
✓ should be purely decorative (24 ms)
Animation
✓ should have pulse animation (1 ms)
✓ should apply animation to all skeleton elements (1 ms)
PASS src/components/ui/touch-swipe.test.tsx
TouchSwipe
Rendering
✓ should render children (6 ms)
✓ should apply custom className (2 ms)
Touch Events
✓ should handle touch start (2 ms)
✓ should handle touch end (64 ms)
✓ should call onSwipeLeft when swiping left (4 ms)
✓ should call onSwipeRight when swiping right (6 ms)
✓ should not trigger swipe when below threshold (3 ms)
Threshold
✓ should use default threshold of 50 (3 ms)
✓ should accept custom threshold (5 ms)
PASS src/hooks/use-intersection-observer.test.ts
useIntersectionObserver
Initial State
✓ should return ref and isIntersecting state (2 ms)
✓ should return ref with null current value
Options
✓ should accept threshold option (1 ms)
✓ should accept root option (1 ms)
✓ should accept rootMargin option (2 ms)
✓ should accept freezeOnceVisible option (1 ms)
✓ should use default options (1 ms)
✓ should accept multiple thresholds (2 ms)
Behavior
✓ should not observe when freezeOnceVisible is true and already intersecting (1 ms)
Cleanup
✓ should cleanup observer on unmount (1 ms)
Type Safety
✓ should work with different element types (3 ms)
PASS src/lib/utils.test.ts
utils
cn
✓ should merge class names correctly (6 ms)
✓ should handle conditional classes (1 ms)
✓ should handle empty input
formatNumber
✓ should format numbers with Chinese locale (5 ms)
✓ should handle decimal numbers (1 ms)
✓ 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 (4 ms)
✓ should cancel previous calls (23 ms)
throttle
✓ should limit function execution rate (2 ms)
randomBetween
✓ should generate number in range
✓ should handle negative numbers (4 ms)
lerp
✓ should interpolate between values (1 ms)
✓ should handle edge cases
clamp
✓ should clamp values within range
✓ should handle equal min and max
PASS src/components/ui/badge.test.tsx
Badge
Rendering
✓ should render badge with text (7 ms)
✓ should render as span by default (1 ms)
✓ should have data-slot attribute (20 ms)
Variants
✓ should render default variant (4 ms)
✓ should render secondary variant (2 ms)
✓ should render destructive variant (2 ms)
✓ should render outline variant (5 ms)
✓ should render ghost variant (2 ms)
✓ should render success variant (2 ms)
✓ should render warning variant (4 ms)
✓ should render info variant (3 ms)
Styling
✓ should apply custom className (15 ms)
✓ should have rounded-full class (3 ms)
✓ should have inline-flex class (1 ms)
AsChild
✓ should render as child component when asChild is true (3 ms)
PASS src/hooks/use-media-query.test.ts
useMediaQuery
useMediaQuery
✓ should return false on server side (10 ms)
✓ should return boolean value (5 ms)
useIsMobile
✓ should return boolean value (11 ms)
✓ should use correct media query (2 ms)
useIsTablet
✓ should return boolean value (3 ms)
✓ should use correct media query (2 ms)
useIsDesktop
✓ should return boolean value (1 ms)
✓ should use correct media query (3 ms)
Media Query Behavior
✓ should handle different queries (1 ms)
✓ should handle complex queries (1 ms)
PASS src/components/ui/animated-number.test.tsx
AnimatedNumber
Rendering
✓ should render number (3 ms)
✓ should render with prefix (17 ms)
✓ should render with suffix (2 ms)
✓ should render with prefix and suffix (1 ms)
✓ should render with custom className (1 ms)
Animation
✓ should accept duration prop (1 ms)
✓ should accept delay prop
✓ should start from 0 (1 ms)
Edge Cases
✓ should handle zero value (1 ms)
✓ should handle large numbers (1 ms)
✓ should handle decimal numbers (1 ms)
StatCard
Rendering
✓ should render stat card (2 ms)
✓ should render with prefix (2 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
✓ should have group class (1 ms)
PASS src/lib/auth.test.ts
Auth Module Configuration
Provider Configuration
✓ should export handlers (75 ms)
✓ should export signIn function
✓ should export signOut function
✓ should export auth function
Auth Options
✓ should have authOptions in handlers
✓ should have providers configured
✓ should have correct provider name (1 ms)
✓ should have email credential
✓ should have password credential
Page Configuration
✓ should have correct sign-in page
✓ should have correct error page
Session Configuration
✓ should use JWT session strategy
Callbacks
✓ should have jwt callback (1 ms)
✓ should have session callback
PASS src/lib/colors.test.ts
colors
brandColors
✓ should have primary color palette (1 ms)
✓ should have brand color palette (4 ms)
✓ should have neutral color palette
✓ should have success color palette (1 ms)
✓ should have warning color palette
✓ should have info color palette (1 ms)
✓ should have error color palette
✓ should have valid hex color format (1 ms)
colorValues
✓ should have primary colors (1 ms)
✓ should have brand colors
✓ should have text colors (4 ms)
✓ should have background colors (1 ms)
✓ should have border colors
✓ should have link colors
✓ should have status colors (1 ms)
✓ should have valid hex color format (1 ms)
gradients
✓ should have primary gradient
✓ 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 (1 ms)
✓ should export Gradient type
PASS src/hooks/use-scroll-reveal.test.ts
useScrollReveal
useScrollReveal
✓ should return ref and isVisible state (2 ms)
✓ should accept custom options (1 ms)
✓ should use default options (2 ms)
useScrollProgress
✓ should return progress value (2 ms)
✓ should accept threshold option (2 ms)
✓ should use default threshold (7 ms)
useParallax
✓ should return ref and offset (1 ms)
✓ should accept speed option (1 ms)
✓ should use default speed (1 ms)
✓ should handle different speed values (1 ms)
Cleanup
✓ should cleanup intersection observer on unmount (1 ms)
✓ should cleanup scroll listener on unmount
✓ should cleanup parallax scroll listener on unmount (2 ms)
PASS src/hooks/use-focus-trap.test.ts
useFocusTrap
Initial State
✓ should return a ref (2 ms)
When Active
✓ should store previous active element (1 ms)
✓ should add keydown event listener (2 ms)
✓ should set body overflow to hidden (2 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 (3 ms)
Tab Navigation
✓ should handle Tab key press (2 ms)
✓ should handle Shift+Tab key press (1 ms)
Escape Key
✓ should handle Escape key press (1 ms)
State Changes
✓ should handle activation change (2 ms)
PASS src/lib/auth/check-permission.test.ts
check-permission
checkPermission
✓ should return allowed: false when no session
✓ should return allowed: false when no user (1 ms)
✓ should return allowed: true for admin with valid permission
✓ should return allowed: false for viewer with invalid permission (1 ms)
✓ should return allowed: true for editor with valid permission
✓ should return allowed: false for editor with delete permission (2 ms)
✓ should handle different resources
requirePermission
✓ should throw error when no permission (5 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 (1 ms)
PASS src/lib/validation.test.ts
validation
email validation
✓ should accept valid email (1 ms)
✓ should reject invalid email
✓ should reject null or undefined (1 ms)
✓ should reject non-string values
phone validation
✓ should accept valid phone numbers (1 ms)
✓ 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
✓ should reject non-string values (1 ms)
URL validation
✓ should accept valid URLs (2 ms)
✓ should reject invalid URLs
✓ should reject null or undefined (1 ms)
✓ should reject non-string values (1 ms)
required validation
✓ should accept non-empty strings
✓ should reject empty strings
✓ should accept valid numbers
✓ should reject NaN
✓ should accept non-empty arrays
✓ should reject empty arrays (1 ms)
✓ should accept objects
✓ should reject null and undefined
✓ should accept booleans (1 ms)
length validation
✓ should accept strings within range
✓ should reject strings shorter than minimum
✓ should reject strings longer than maximum (1 ms)
✓ should reject non-string values
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 (1 ms)
✓ should reject invalid Chinese ID numbers
✓ should reject null or undefined
✓ should reject non-string values (1 ms)
username validation
✓ should accept valid usernames
✓ should reject usernames with special characters (1 ms)
✓ should reject usernames that are too short
✓ should reject usernames that are too long
✓ should reject null or undefined
✓ should reject non-string values (7 ms)
PASS src/lib/sentry.test.ts
sentry
initSentry
✓ should not initialize Sentry in non-production environment (2 ms)
✓ should not initialize Sentry when DSN is not set (1 ms)
✓ should initialize Sentry in production with DSN (38 ms)
✓ should handle missing NODE_ENV gracefully (1 ms)
PASS src/lib/sanitize.test.ts
sanitize
sanitizeHTML
✓ should allow safe HTML tags (8 ms)
✓ should remove dangerous tags (12 ms)
✓ should remove dangerous attributes (6 ms)
✓ should handle empty input (2 ms)
sanitizeInput
✓ should remove all HTML tags (3 ms)
✓ should handle special characters (1 ms)
sanitizeURL
✓ should allow valid http URLs
✓ should allow valid https URLs (1 ms)
✓ should allow mailto URLs
✓ should reject javascript URLs
✓ should reject data URLs (6 ms)
escapeHTML
✓ should escape HTML special characters (1 ms)
✓ should handle mixed content
✓ should handle empty string (1 ms)
PASS src/lib/audit.test.ts
audit
createAuditLog
✓ should create audit log successfully (1 ms)
✓ should handle missing optional fields (1 ms)
✓ 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 (73 ms)
PASS src/lib/constants.test.ts
Constants
COMPANY_INFO
✓ should have company name (1 ms)
✓ should have short name (1 ms)
✓ should have slogan
✓ should have contact information (1 ms)
✓ should have legal information
NAVIGATION
✓ should be an array (21 ms)
✓ should have navigation items (2 ms)
✓ should have required properties (2 ms)
✓ should have home navigation (12 ms)
✓ should have contact navigation (1 ms)
STATS
✓ should be an array (1 ms)
✓ should have stat items
✓ should have required properties (2 ms)
✓ should have numeric values (1 ms)
SERVICES
✓ should be an array
✓ should have service items
✓ should have required properties (8 ms)
✓ should have software service
✓ should have cloud service (1 ms)
✓ should have data service (1 ms)
✓ should have security service (1 ms)
✓ should have features as array (3 ms)
✓ should have benefits as array (1 ms)
PRODUCTS
✓ should be an array
✓ should have product items
✓ should have required properties (27 ms)
✓ should have ERP product (2 ms)
✓ should have CRM product (1 ms)
✓ should have CMS product
✓ should have BI product
✓ should have pricing object
NEWS
✓ should be an array
✓ should have news items (1 ms)
✓ should have required properties (1 ms)
✓ should have valid categories (1 ms)
✓ should have valid date format
✓ should have founding news
PASS src/lib/analytics.test.ts
analytics
pageview
✓ should be defined (1 ms)
✓ 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 (1 ms)
trackButtonClick
✓ should be defined (1 ms)
✓ should be callable
trackPageView
✓ should be defined
✓ should be callable
PASS src/lib/monitoring.test.ts
PerformanceMonitor
getInstance
✓ should return singleton instance (1 ms)
recordMetric
✓ should record a metric value
✓ should record multiple metric values (1 ms)
✓ should maintain max 1000 values per metric
getAverage
✓ should return 0 for empty metric
✓ should calculate average correctly (13 ms)
getPercentile
✓ should return 0 for empty metric (3 ms)
✓ should calculate 50th percentile correctly (10 ms)
✓ should calculate 95th percentile correctly (2 ms)
✓ should calculate 99th percentile correctly (1 ms)
getCount
✓ should return 0 for non-existent metric (1 ms)
✓ should return count for existing metric
getMin
✓ should return 0 for empty metric (1 ms)
✓ should return minimum value (1 ms)
getMax
✓ should return 0 for empty metric
✓ should return maximum value
getStats
✓ should return stats for empty metric
✓ should return complete stats for metric (2 ms)
clearMetrics
✓ should clear specific metric (1 ms)
✓ should clear all metrics when no name provided
PASS src/lib/color-contrast.test.ts
color-contrast
calculateContrastRatio
✓ should calculate contrast ratio for black on white (2 ms)
✓ should calculate contrast ratio for white on black (1 ms)
✓ should calculate contrast ratio for gray on white (1 ms)
✓ should calculate contrast ratio for dark blue on white
✓ should calculate contrast ratio for same colors
✓ should handle lowercase hex
meetsWCAGStandard
AA level - normal text
✓ should pass for black on white
✓ should fail for light gray on white (1 ms)
✓ should pass for dark blue on white
AA level - large text
✓ should pass for gray on white (1 ms)
✓ 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 (24 ms)
✓ should default to normal text size (1 ms)
result structure
✓ should return result with all required properties (2 ms)
PASS src/lib/gradients.test.ts
gradients
getGradientStyle
✓ should return primary gradient style
✓ should return hero gradient style (1 ms)
✓ should return brand gradient style
✓ should return subtle gradient style (1 ms)
✓ should return card gradient style
✓ should return cta gradient style (1 ms)
getGlowStyle
✓ should return primary glow style with default opacity (1 ms)
✓ should return brand glow style with default opacity (1 ms)
✓ should return glow style with custom opacity
✓ should return glow style with zero opacity
✓ should return glow style with full opacity (1 ms)
getBorderGradientStyle
✓ should return border gradient style
getTextGradientStyle
✓ should return primary text gradient style (2 ms)
✓ should return brand text gradient style
✓ should default to primary gradient (1 ms)
getHeroGradientStyle
✓ should return hero gradient style (17 ms)
getCTAGradientStyle
✓ should return CTA gradient style
PASS src/lib/integration.test.ts
Integration Tests
Input Sanitization Flow
✓ should sanitize user input end-to-end (6 ms)
✓ should sanitize HTML content (24 ms)
✓ should sanitize URLs (1 ms)
CSRF Protection Flow
✓ should generate and validate CSRF tokens (2 ms)
✓ should reject invalid CSRF tokens
✓ should reject empty tokens (1 ms)
File Validation Flow
✓ should validate allowed file types
✓ should reject dangerous file types (1 ms)
✓ should validate file signatures (7 ms)
Color Contrast Validation Flow
✓ should validate accessible color combinations
✓ should reject inaccessible color combinations (1 ms)
✓ should calculate contrast ratios correctly (1 ms)
Performance Monitoring Flow
✓ should track metrics across operations (1 ms)
✓ should track multiple metrics independently (1 ms)
Combined Security Validation Flow
✓ should validate and sanitize user input comprehensively (26 ms)
✓ should validate file upload with CSRF protection (1 ms)
PASS src/lib/csrf.test.ts
csrf
generateCSRFToken
✓ should generate a token of correct length
✓ should generate unique tokens
✓ should only contain hexadecimal characters (1 ms)
validateCSRFToken
✓ should return true for matching tokens (1 ms)
✓ should return false for mismatched tokens
✓ should return false for empty tokens
getCSRFTokenFromStorage
✓ should return token from sessionStorage (1 ms)
✓ should return null when token not found (1 ms)
setCSRFTokenToStorage
✓ should set token in sessionStorage
----------------------------------|---------|----------|---------|---------|---------------------------------------------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
----------------------------------|---------|----------|---------|---------|---------------------------------------------------------
All files | 31.41 | 25.25 | 31.45 | 31.4 |
app | 0 | 0 | 0 | 0 |
error.tsx | 0 | 0 | 0 | 0 | 3-19
layout.tsx | 0 | 100 | 0 | 0 | 2-119
not-found.tsx | 0 | 100 | 0 | 0 | 3-43
app/(marketing) | 0 | 0 | 0 | 0 |
layout.tsx | 0 | 100 | 0 | 0 | 1-10
page.tsx | 0 | 0 | 0 | 0 | 3-80
app/(marketing)/about | 0 | 0 | 0 | 0 |
client.tsx | 0 | 0 | 0 | 0 | 3-215
page.tsx | 0 | 100 | 0 | 0 | 1-10
app/(marketing)/cases | 0 | 0 | 0 | 0 |
layout.tsx | 0 | 100 | 0 | 0 | 3-13
page.tsx | 0 | 0 | 0 | 0 | 3-32
app/(marketing)/cases/[id] | 0 | 0 | 0 | 0 |
client.tsx | 0 | 0 | 0 | 0 | 3-286
page.tsx | 0 | 0 | 0 | 0 | 2-36
app/(marketing)/contact | 0 | 0 | 0 | 0 |
actions.ts | 0 | 0 | 0 | 0 | 9-27
layout.tsx | 0 | 100 | 0 | 0 | 1-7
page.tsx | 0 | 0 | 0 | 0 | 3-340
app/(marketing)/news | 0 | 0 | 0 | 0 |
page.tsx | 0 | 0 | 0 | 0 | 3-93
app/(marketing)/news/[slug] | 0 | 0 | 0 | 0 |
NewsDetailClient.tsx | 0 | 0 | 0 | 0 | 3-75
page.tsx | 0 | 0 | 0 | 0 | 1-36
app/(marketing)/products | 0 | 0 | 0 | 0 |
page.tsx | 0 | 0 | 0 | 0 | 3-74
app/(marketing)/products/[id] | 0 | 0 | 0 | 0 |
page.tsx | 0 | 0 | 0 | 0 | 1-135
app/(marketing)/services | 0 | 0 | 0 | 0 |
page.tsx | 0 | 0 | 0 | 0 | 3-83
app/(marketing)/services/[id] | 0 | 0 | 0 | 0 |
client.tsx | 0 | 0 | 0 | 0 | 3-241
page.tsx | 0 | 0 | 0 | 0 | 2-36
app/(marketing)/solutions | 0 | 0 | 0 | 0 |
layout.tsx | 0 | 100 | 0 | 0 | 3-13
page.tsx | 0 | 0 | 0 | 0 | 3-226
app/admin | 0 | 0 | 0 | 0 |
layout.tsx | 0 | 0 | 0 | 0 | 3-137
page.tsx | 0 | 0 | 0 | 0 | 1-111
app/admin/content | 0 | 0 | 0 | 0 |
page.tsx | 0 | 0 | 0 | 0 | 3-306
app/admin/content/[id] | 0 | 0 | 0 | 0 |
page.tsx | 0 | 0 | 0 | 0 | 3-364
app/admin/login | 0 | 0 | 0 | 0 |
page.tsx | 0 | 0 | 0 | 0 | 3-98
app/admin/logs | 0 | 0 | 0 | 0 |
page.tsx | 0 | 0 | 0 | 0 | 3-251
app/admin/settings | 0 | 0 | 0 | 0 |
page.tsx | 0 | 0 | 0 | 0 | 3-255
app/admin/users | 0 | 0 | 0 | 0 |
page.tsx | 0 | 0 | 0 | 0 | 3-386
app/api/admin/config | 0 | 0 | 0 | 0 |
route.ts | 0 | 0 | 0 | 0 | 1-201
app/api/admin/content | 0 | 0 | 0 | 0 |
route.ts | 0 | 0 | 0 | 0 | 1-147
app/api/admin/content/[id] | 0 | 0 | 0 | 0 |
route.ts | 0 | 0 | 0 | 0 | 1-202
app/api/admin/logs | 0 | 0 | 0 | 0 |
route.ts | 0 | 0 | 0 | 0 | 1-83
app/api/admin/upload | 0 | 0 | 0 | 0 |
route.ts | 0 | 0 | 0 | 0 | 1-92
app/api/admin/users | 0 | 0 | 0 | 0 |
route.ts | 0 | 0 | 0 | 0 | 1-100
app/api/admin/users/[id] | 0 | 0 | 0 | 0 |
route.ts | 0 | 0 | 0 | 0 | 1-153
app/api/auth/[...nextauth] | 100 | 100 | 100 | 100 |
route.ts | 100 | 100 | 100 | 100 |
app/api/contact | 100 | 100 | 100 | 100 |
route.ts | 100 | 100 | 100 | 100 |
app/api/health | 0 | 0 | 0 | 0 |
route.ts | 0 | 0 | 0 | 0 | 1-66
app/preview/effects | 0 | 0 | 0 | 0 |
page.tsx | 0 | 0 | 0 | 0 | 3-314
app/privacy | 0 | 100 | 0 | 0 |
page.tsx | 0 | 100 | 0 | 0 | 3-9
app/terms | 0 | 100 | 0 | 0 |
page.tsx | 0 | 100 | 0 | 0 | 3-9
components/admin | 0 | 0 | 0 | 0 |
RichTextEditor.tsx | 0 | 0 | 0 | 0 | 3-214
components/analytics | 0 | 0 | 0 | 0 |
GoogleAnalytics.tsx | 0 | 0 | 0 | 0 | 3-18
web-vitals.tsx | 0 | 0 | 0 | 0 | 3-32
components/effects | 0 | 0 | 0 | 0 |
advanced-floating-effects.tsx | 0 | 0 | 0 | 0 | 3-450
data-particle-flow.tsx | 0 | 0 | 0 | 0 | 3-195
fluid-wave-background.tsx | 0 | 0 | 0 | 0 | 3-237
geometric-abstract.tsx | 0 | 0 | 0 | 0 | 3-163
geometric-shapes.tsx | 0 | 0 | 0 | 0 | 3-56
glow-effect.tsx | 0 | 0 | 0 | 0 | 3-72
gradient-animation.tsx | 0 | 0 | 0 | 0 | 3-37
gradient-flow-optimized.tsx | 0 | 0 | 0 | 0 | 3-70
gradient-flow.tsx | 0 | 0 | 0 | 0 | 3-35
gradient-grid.tsx | 0 | 0 | 0 | 0 | 3-57
gradient-orbs.tsx | 0 | 0 | 0 | 0 | 3-92
grid-lines.tsx | 0 | 0 | 0 | 0 | 3-70
ink-tech-fusion.tsx | 0 | 0 | 0 | 0 | 3-135
mesh-gradient.tsx | 0 | 0 | 0 | 0 | 3-89
mouse-interactive-particles.tsx | 0 | 0 | 0 | 0 | 3-194
parallax-effect.tsx | 0 | 0 | 0 | 0 | 3-77
particle-galaxy.tsx | 0 | 0 | 0 | 0 | 3-229
seal-animation-enhanced.tsx | 0 | 0 | 0 | 0 | 3-171
subtle-dots.tsx | 0 | 0 | 0 | 0 | 3-71
subtle-particles.tsx | 0 | 0 | 0 | 0 | 3-74
tech-grid-flow.tsx | 0 | 0 | 0 | 0 | 3-106
components/examples | 0 | 100 | 0 | 0 |
ContactFormAnalyticsExample.tsx | 0 | 100 | 0 | 0 | 3-93
components/layout | 59.87 | 48.95 | 56.41 | 60.24 |
breadcrumb.tsx | 0 | 100 | 0 | 0 | 3-22
footer.tsx | 100 | 100 | 100 | 100 |
header.tsx | 46.46 | 34.84 | 42.85 | 46.93 | 29,36-54,62-63,74,80-85,90-123,135,173,237,261-304
mobile-menu.tsx | 79.41 | 85 | 72.72 | 79.41 | 30-33,41,87-88
mobile-tab-bar.tsx | 100 | 70 | 100 | 100 | 24-51
components/sections | 78.76 | 61.65 | 71.42 | 80.65 |
about-section.tsx | 100 | 50 | 100 | 100 | 22-62
cases-section.tsx | 100 | 66.66 | 50 | 100 | 28-54,95
contact-section.tsx | 60.43 | 47.22 | 80.95 | 59.77 | 69,84,93-147,157
hero-section.tsx | 69.49 | 68.42 | 43.47 | 78 | 13,18,23,73-75,80-82,167-168
insights-section.tsx | 94.73 | 78.57 | 83.33 | 94.44 | 120
news-section.tsx | 100 | 50 | 100 | 100 | 22-74
products-section.tsx | 100 | 50 | 100 | 100 | 24-100
services-section.tsx | 100 | 66.66 | 100 | 100 | 31,76
testimonials-section.tsx | 100 | 75 | 100 | 100 | 53-60
components/seo | 0 | 100 | 0 | 0 |
structured-data.tsx | 0 | 100 | 0 | 0 | 1-74
components/ui | 49.2 | 38.61 | 44.38 | 50.31 |
animated-card.tsx | 92.75 | 92.1 | 92.85 | 96.96 | 232-233
animated-number.tsx | 56.66 | 66.66 | 75 | 58.62 | 37-54
back-button.tsx | 100 | 100 | 100 | 100 |
badge.tsx | 100 | 100 | 100 | 100 |
button.tsx | 100 | 100 | 100 | 100 |
card.tsx | 100 | 100 | 100 | 100 |
dialog.tsx | 100 | 100 | 100 | 100 |
dropdown-menu.tsx | 82.6 | 42.85 | 55.55 | 92.45 | 24,54,106,140
error-boundary.tsx | 90 | 100 | 80 | 90 | 54
flip-clock.tsx | 0 | 0 | 0 | 0 | 3-129
glass-card.tsx | 100 | 100 | 100 | 100 |
ink-decoration.tsx | 0 | 0 | 0 | 0 | 3-559
input.tsx | 100 | 100 | 100 | 100 |
insight-card.tsx | 100 | 100 | 100 | 100 |
loading-skeleton.tsx | 100 | 100 | 100 | 100 |
optimized-image.tsx | 100 | 89.58 | 100 | 100 | 43,72,81,98,160
page-header.tsx | 100 | 69.23 | 100 | 100 | 37,44-54,64
page-transitions.tsx | 0 | 0 | 0 | 0 | 3-409
particle-background.tsx | 0 | 0 | 0 | 0 | 3-103
ripple-button.tsx | 0 | 0 | 0 | 0 | 3-193
scroll-animations.tsx | 0 | 0 | 0 | 0 | 3-436
sheet.tsx | 94.73 | 100 | 90 | 94.44 | 20-22
testimonial-card.tsx | 100 | 100 | 100 | 100 |
textarea.tsx | 100 | 100 | 100 | 100 |
toast.tsx | 100 | 100 | 100 | 100 |
touch-button.tsx | 100 | 100 | 100 | 100 |
touch-optimized.tsx | 0 | 0 | 0 | 0 | 3-268
touch-swipe.tsx | 100 | 81.25 | 100 | 100 | 24-30,37
contexts | 0 | 0 | 0 | 0 |
theme-context.tsx | 0 | 0 | 0 | 0 | 3-25
db | 18 | 0 | 0 | 18.75 |
index.ts | 0 | 0 | 100 | 0 | 1-8
schema.ts | 56.25 | 100 | 0 | 64.28 | 27,36-41,52,57
seed.ts | 0 | 0 | 0 | 0 | 1-115
hooks | 66.14 | 36 | 78.78 | 65.25 |
use-focus-trap.ts | 55.26 | 25 | 83.33 | 52.77 | 12-17,25-45
use-intersection-observer.ts | 55.55 | 46.15 | 50 | 56.25 | 24-38
use-media-query.ts | 86.36 | 50 | 81.81 | 86.36 | 7,13,18
use-scroll-reveal.ts | 69.38 | 45.45 | 83.33 | 68.18 | 21-37,79-84
lib | 82.85 | 73.31 | 80.64 | 82.78 |
analytics.ts | 61.11 | 16.66 | 0 | 46.15 | 10-11,18-19,28,32,36
animations.tsx | 65.74 | 63.2 | 65.11 | 66.04 | 261,322,326,353-370,409-422,662-668,672,784-786,888-934
audit.ts | 100 | 90 | 100 | 100 | 21
auth.ts | 28 | 0 | 0 | 28 | 17-63
color-contrast.ts | 100 | 100 | 100 | 100 |
colors.ts | 100 | 100 | 100 | 100 |
constants.ts | 100 | 100 | 100 | 100 |
csrf.ts | 88.23 | 75 | 100 | 87.5 | 17,25
email-templates.ts | 100 | 100 | 100 | 100 |
gradients.ts | 100 | 100 | 100 | 100 |
monitoring.ts | 100 | 100 | 100 | 100 |
sanitize.ts | 100 | 88.88 | 100 | 100 | 41
sentry.ts | 83.33 | 100 | 75 | 80 | 4
upload.ts | 100 | 88.57 | 100 | 100 | 106-108,131
utils.ts | 100 | 100 | 100 | 100 |
validation.ts | 100 | 100 | 100 | 100 |
lib/auth | 100 | 100 | 100 | 100 |
check-permission.ts | 100 | 100 | 100 | 100 |
permissions.ts | 100 | 100 | 100 | 100 |
session.ts | 100 | 100 | 100 | 100 |
providers | 0 | 100 | 0 | 0 |
session-provider.tsx | 0 | 100 | 0 | 0 | 3-7
----------------------------------|---------|----------|---------|---------|---------------------------------------------------------
Jest: "global" coverage threshold for statements (35%) not met: 31.41%
Jest: "global" coverage threshold for branches (30%) not met: 25.25%
Jest: "global" coverage threshold for lines (35%) not met: 31.4%
Jest: "global" coverage threshold for functions (35%) not met: 31.45%
Test Suites: 62 passed, 62 total
Tests: 1073 passed, 1073 total
Snapshots: 0 total
Time: 17.451 s
Ran all test suites.