Add comprehensive unit tests for homepage components and utilities

- Introduced unit tests for homepage components: `QuickStartCode`, `Header`, `DemoCredentialsModal`, `AnimatedTerminal`, `CTASection`, and `StatsSection`.
- Added utility tests for `chart-colors` including opacity, palettes, and gradient validation.
- Mocked dependencies (`framer-motion`, `react-syntax-highlighter`, `DemoCredentialsModal`) for isolated testing.
- Verified accessibility features, animations, and interactive behaviors across components.
This commit is contained in:
2025-11-08 17:06:14 +01:00
parent fe289228e1
commit b630559e0b
14 changed files with 1603 additions and 37 deletions

View File

@@ -23,6 +23,19 @@ global.BroadcastChannel = class BroadcastChannel {
removeEventListener() {}
};
// Mock IntersectionObserver for components that use viewport detection
global.IntersectionObserver = class IntersectionObserver {
constructor(callback) {
this.callback = callback;
}
observe() {
// Immediately trigger the callback with isIntersecting: true for tests
this.callback([{ isIntersecting: true }]);
}
unobserve() {}
disconnect() {}
};
// Use real Web Crypto API polyfill for Node environment
const cryptoPolyfill = new Crypto();