Skip to content

Commit 27aa9f8

Browse files
committed
refactor: restructure component folders and improve mock organization
- Rename ui/ to micro/ for better semantic clarity - Move RecaptchaProvider to app/ folder as it's part of page layout - Create proper ContactForm mock in micro/__mocks__/ - Fix Badge mock to preserve data-testid props - Simplify test files to use __mocks__ folder structure - Remove empty providers/ folder - Update all import statements to use new micro/ path All 361 tests passing with improved component organization.
1 parent 1977434 commit 27aa9f8

59 files changed

Lines changed: 83 additions & 84 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
File renamed without changes.

src/app/__tests__/page.contact.test.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,8 @@ import Home from '../page'
44

55
// Mock the modules using the __mocks__ files
66
jest.mock('@/lib/blog-data')
7-
jest.mock('@/components/ui/Typewriter')
8-
jest.mock('@/components/ui/ThemeToggle')
9-
jest.mock('@/components/sections/HeroSection')
10-
jest.mock('@/components/sections/FeaturedProjects')
11-
jest.mock('@/components/sections/TechnicalExpertise')
12-
jest.mock('@/components/sections/ProfessionalJourney')
13-
jest.mock('@/components/sections/ContactSection')
14-
jest.mock('@/components/sections/blog-preview-section')
7+
jest.mock('@/components/micro')
8+
jest.mock('@/components/sections')
159

1610
describe('Home Page Contact Section', () => {
1711
it('renders the contact section', async () => {

src/app/__tests__/page.content.test.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,8 @@ import Home from '../page'
44

55
// Mock the modules using the __mocks__ files
66
jest.mock('@/lib/blog-data')
7-
jest.mock('@/components/ui/Typewriter')
8-
jest.mock('@/components/ui/ThemeToggle')
9-
jest.mock('@/components/sections/HeroSection')
10-
jest.mock('@/components/sections/FeaturedProjects')
11-
jest.mock('@/components/sections/TechnicalExpertise')
12-
jest.mock('@/components/sections/ProfessionalJourney')
13-
jest.mock('@/components/sections/ContactSection')
14-
jest.mock('@/components/sections/blog-preview-section')
7+
jest.mock('@/components/micro')
8+
jest.mock('@/components/sections')
159

1610
describe('Home Page Content', () => {
1711
it('renders the main hero heading', async () => {

src/app/__tests__/page.layout.test.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,8 @@ import Home from '../page'
44

55
// Mock the modules using the __mocks__ files
66
jest.mock('@/lib/blog-data')
7-
jest.mock('@/components/ui/Typewriter')
8-
jest.mock('@/components/ui/ThemeToggle')
9-
jest.mock('@/components/sections/HeroSection')
10-
jest.mock('@/components/sections/FeaturedProjects')
11-
jest.mock('@/components/sections/TechnicalExpertise')
12-
jest.mock('@/components/sections/ProfessionalJourney')
13-
jest.mock('@/components/sections/ContactSection')
14-
jest.mock('@/components/sections/blog-preview-section')
7+
jest.mock('@/components/micro')
8+
jest.mock('@/components/sections')
159

1610
describe('Home Page Layout', () => {
1711
it('renders the main container with proper classes', async () => {

src/app/__tests__/page.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Home from '../page'
44

55
// Mock the modules using the __mocks__ files
66
jest.mock('@/lib/blog-data')
7-
jest.mock('@/components/ui')
7+
jest.mock('@/components/micro')
88
jest.mock('@/components/sections')
99

1010
describe('Home Page', () => {

src/app/blog/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { BlogPostList } from '@/components/blog';
22
import { Footer } from '@/components/sections';
33
import Link from 'next/link';
4-
import { ThemeToggle } from '@/components/ui';
4+
import { ThemeToggle } from '@/components/micro';
55
import { getPublishedBlogPosts } from '@/lib/blog-data';
66
import { footerContent, blogPageContent } from '@/content';
77

src/app/layout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import type { Metadata } from "next";
22
import { JetBrains_Mono, Inter } from "next/font/google";
33
import "./globals.css";
44
import { ThemeProvider } from '@/lib/theme'
5-
import { ProgressBar } from '@/components/ui';
6-
import { RecaptchaProvider } from '@/components/providers';
5+
import { ProgressBar } from '@/components/micro';
6+
import { RecaptchaProvider } from './RecaptchaProvider';
77

88
const jetbrainsMono = JetBrains_Mono({
99
variable: "--font-jetbrains-mono",

src/app/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { HeroSection, FeaturedProjects, TechnicalExpertise, ProfessionalJourney, ContactSection, BlogPreviewSection, Footer } from "@/components/sections";
2-
import { ThemeToggle } from '@/components/ui';
2+
import { ThemeToggle } from '@/components/micro';
33
import { getPublishedBlogPosts } from '@/lib/blog-data';
44
import { heroContent, contactContent, professionalMilestones, projectsContent, technicalExpertiseContent, footerContent } from '@/content';
55

src/app/thank-you/page.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
import { motion } from 'framer-motion';
44
import { useRouter } from 'next/navigation';
5-
import { Button } from '@/components/ui';
6-
import { Card, CardContent, CardHeader } from '@/components/ui/Card';
5+
import { Button, Card, CardContent, CardHeader } from '@/components/micro';
76

87
// Animation variants for the success checkmark
98
const checkmarkVariants = {

src/components/blog/__tests__/blog-post-page.test.tsx

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,9 @@ jest.mock('../post-navigation', () => ({
77
PostNavigation: jest.fn(() => <div data-testid="post-navigation" />)
88
}));
99

10-
jest.mock('@/components/ui', () => ({
11-
ThemeToggle: jest.fn(() => <div data-testid="theme-toggle" />),
12-
Badge: jest.fn(({ children, ...props }) => <span data-testid="badge" {...props}>{children}</span>),
13-
Card: jest.fn(({ children, ...props }) => <div data-testid="card" {...props}>{children}</div>),
14-
CardContent: jest.fn(({ children, ...props }) => <div data-testid="card-content" {...props}>{children}</div>)
15-
}));
10+
jest.mock('@/components/micro');
1611

17-
jest.mock('@/components/sections', () => ({
18-
Footer: jest.fn(({ content }) => <footer data-testid="footer">{JSON.stringify(content)}</footer>)
19-
}));
12+
jest.mock('@/components/sections');
2013

2114
jest.mock('@/lib', () => ({
2215
parseMarkdown: jest.fn((content: string) => ({
@@ -105,7 +98,7 @@ describe('BlogPostPage', () => {
10598

10699
it('includes footer', () => {
107100
render(<BlogPostPage post={mockBlogPost} />);
108-
expect(screen.getByTestId('footer')).toBeInTheDocument();
101+
expect(screen.getByTestId('footer-mock')).toBeInTheDocument();
109102
});
110103

111104
it('handles posts without tags', () => {

0 commit comments

Comments
 (0)