Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions app/components/FeatureCard.test.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/no-unused-vars */
import { describe, it, expect, vi } from 'vitest';
import { render, screen } from '@testing-library/react';
import { FeatureCard } from './FeatureCard';
Expand All @@ -6,9 +8,18 @@ import { FeatureCard } from './FeatureCard';
// don't mean anything to jsdom, so we stub motion.div with a plain div.
vi.mock('framer-motion', () => ({
motion: {
div: ({ children, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
<div {...props}>{children}</div>
),
div: ({
children,
whileHover,
whileTap,
whileInView,
initial,
animate,
exit,
transition,
viewport,
...props
}: any) => <div {...props}>{children}</div>,
},
}));

Expand Down
47 changes: 44 additions & 3 deletions app/page.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable @next/next/no-img-element, jsx-a11y/alt-text */
import { render, screen, fireEvent, waitFor, act } from '@testing-library/react';
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
Expand Down Expand Up @@ -31,17 +32,57 @@ vi.mock('next/link', () => ({
// Mock framer-motion
vi.mock('framer-motion', () => ({
motion: {
div: ({ children, className, ...props }: any) => (
div: ({
children,
className,
whileHover,
whileTap,
whileInView,
initial,
animate,
exit,
transition,
viewport,
layoutId,
...props
}: any) => (
<div className={className} data-testid="motion-div" {...props}>
{children}
</div>
),
p: ({ children, className, ...props }: any) => (
p: ({
children,
className,
whileHover,
whileTap,
whileInView,
initial,
animate,
exit,
transition,
viewport,
layoutId,
...props
}: any) => (
<p className={className} data-testid="motion-p" {...props}>
{children}
</p>
),
a: ({ children, className, href, ...props }: any) => (
a: ({
children,
className,
href,
whileHover,
whileTap,
whileInView,
initial,
animate,
exit,
transition,
viewport,
layoutId,
...props
}: any) => (
<a href={href} className={className} data-testid="motion-a" {...props}>
{children}
</a>
Expand Down
15 changes: 14 additions & 1 deletion components/dashboard/AIInsights.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/no-unused-vars */
import { describe, it, expect, vi, beforeEach } from 'vitest';
import { render, screen } from '@testing-library/react';
import AIInsights from './AIInsights';
Expand All @@ -7,7 +8,19 @@ import type { AIInsight } from '@/types/dashboard';
// Mock framer-motion
vi.mock('framer-motion', () => ({
motion: {
div: ({ children, ...props }: any) => (
div: ({
children,
whileHover,
whileTap,
whileInView,
initial,
animate,
exit,
transition,
viewport,
layoutId,
...props
}: any) => (
<div {...props} data-testid="motion-div">
{children}
</div>
Expand Down
15 changes: 14 additions & 1 deletion components/dashboard/StatsCard.test.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/no-unused-vars */
import { describe, it, expect, vi, beforeEach } from 'vitest';
import { render, screen } from '@testing-library/react';
import StatsCard from './StatsCard';

// Mock framer-motion
vi.mock('framer-motion', () => ({
motion: {
div: ({ children, ...props }: any) => (
div: ({
children,
whileHover,
whileTap,
whileInView,
initial,
animate,
exit,
transition,
viewport,
layoutId,
...props
}: any) => (
<div {...props} data-testid="motion-div">
{children}
</div>
Expand Down
Loading