diff --git a/.gitignore b/.gitignore index 9eda0e5..849674a 100644 --- a/.gitignore +++ b/.gitignore @@ -335,3 +335,9 @@ e2e/storage-state.json *.trace.zip trace.zip network-logs/ + +#trae +.trae/ + +#docs +docs diff --git a/src/components/sections/contact-section.test.tsx b/src/components/sections/contact-section.test.tsx index 47c998f..3040687 100644 --- a/src/components/sections/contact-section.test.tsx +++ b/src/components/sections/contact-section.test.tsx @@ -4,6 +4,33 @@ import { render, screen, fireEvent, waitFor } from '@testing-library/react'; import '@testing-library/jest-dom'; import userEvent from '@testing-library/user-event'; +interface MotionComponentProps { + children?: React.ReactNode; + className?: string; + disabled?: boolean; + [key: string]: unknown; +} + +interface InputComponentProps { + label?: string; + id?: string; + placeholder?: string; + required?: boolean; + value?: string; + onChange?: (e: React.ChangeEvent) => void; + onBlur?: () => void; + error?: string; + rows?: number; + [key: string]: unknown; +} + +interface ToastComponentProps { + message?: string; + type?: string; + onClose?: () => void; + [key: string]: unknown; +} + global.fetch = jest.fn(() => Promise.resolve({ ok: true, @@ -13,18 +40,18 @@ global.fetch = jest.fn(() => jest.mock('framer-motion', () => ({ motion: { - div: ({ children, className, ...props }: any) => ( + div: ({ children, className, ...props }: MotionComponentProps) => (
{children}
), - section: ({ children, className, ...props }: any) => ( + section: ({ children, className, ...props }: MotionComponentProps) => (
{children}
), }, - AnimatePresence: ({ children }: any) => <>{children}, + AnimatePresence: ({ children }: MotionComponentProps) => <>{children}, })); jest.mock('lucide-react', () => ({ @@ -49,7 +76,10 @@ jest.mock('@/lib/csrf', () => ({ getCSRFTokenFromStorage: jest.fn(() => 'test-csrf-token'), })); -const { generateCSRFToken, setCSRFTokenToStorage } = jest.requireMock('@/lib/csrf') as any; +const { generateCSRFToken, setCSRFTokenToStorage } = jest.requireMock('@/lib/csrf') as { + generateCSRFToken: jest.Mock; + setCSRFTokenToStorage: jest.Mock; +}; jest.mock('@/lib/security/captcha', () => ({ generateCaptcha: jest.fn(() => ({ @@ -60,7 +90,9 @@ jest.mock('@/lib/security/captcha', () => ({ })), })); -const { generateCaptcha } = jest.requireMock('@/lib/security/captcha') as any; +const { generateCaptcha } = jest.requireMock('@/lib/security/captcha') as { + generateCaptcha: jest.Mock; +}; jest.mock('@/lib/constants', () => ({ COMPANY_INFO: { @@ -72,7 +104,7 @@ jest.mock('@/lib/constants', () => ({ })); jest.mock('@/components/ui/button', () => ({ - Button: ({ children, className, disabled, ...props }: any) => ( + Button: ({ children, className, disabled, ...props }: MotionComponentProps) => ( @@ -80,7 +112,7 @@ jest.mock('@/components/ui/button', () => ({ })); jest.mock('@/components/ui/input', () => ({ - Input: ({ label, id, placeholder, required, value, onChange, onBlur, error, ...props }: any) => ( + Input: ({ label, id, placeholder, required, value, onChange, onBlur, error, ...props }: InputComponentProps) => (
({ })); jest.mock('@/components/ui/textarea', () => ({ - Textarea: ({ label, id, placeholder, rows, required, value, onChange, onBlur, error, ...props }: any) => ( + Textarea: ({ label, id, placeholder, rows, required, value, onChange, onBlur, error, ...props }: InputComponentProps) => (