Skip to content

Commit 36d92d2

Browse files
committed
refactor: clean up blog page and remove CSS-based tests
- Remove 11 CSS-based tests from UI components - Move ProfessionalMilestone type to content folder - Add blog page content interface and real data - Clean up unused animation variant exports - Update imports to use folder-based structure - Ensure all tests pass and build succeeds
1 parent cf2920e commit 36d92d2

13 files changed

Lines changed: 76 additions & 129 deletions

File tree

src/app/__tests__/layout.test.tsx

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,7 @@ describe('RootLayout', () => {
2626
expect(getByText('Test Child')).toBeInTheDocument()
2727
})
2828

29-
it('applies font classes to the body', () => {
30-
const { container } = render(
31-
<RootLayout>
32-
<div>Test Child</div>
33-
</RootLayout>
34-
)
35-
// Find the element with the expected classes
36-
const body = container.querySelector('body') || (container.firstChild as Element)
37-
expect(body?.className).toMatch(/antialiased/)
38-
expect(body?.className).toMatch(/variable/)
39-
})
29+
4030

4131
describe('SEO Metadata', () => {
4232
it('has correct title', () => {

src/app/blog/page.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Footer } from '@/components/sections';
33
import Link from 'next/link';
44
import { ThemeToggle } from '@/components/ui';
55
import { getPublishedBlogPosts } from '@/lib/blog-data';
6-
import { footerContent } from '@/content';
6+
import { footerContent, blogPageContent } from '@/content';
77

88
export default async function BlogPage() {
99
const posts = await getPublishedBlogPosts();
@@ -12,12 +12,18 @@ export default async function BlogPage() {
1212
<div className="min-h-screen bg-background text-text flex flex-col">
1313
<div className="flex-1 max-w-6xl mx-auto px-4 py-8 w-full">
1414
<div className="flex justify-between items-center mb-8">
15-
<Link href="/" className="text-accent font-mono text-base hover:underline transition-colors" aria-label="Home">← Home</Link>
15+
<Link
16+
href="/"
17+
className="text-accent font-mono text-base hover:underline transition-colors"
18+
aria-label={blogPageContent.navigation.homeLink.ariaLabel}
19+
>
20+
{blogPageContent.navigation.homeLink.text}
21+
</Link>
1622
<ThemeToggle />
1723
</div>
1824
<header className="mb-12">
19-
<h1 className="text-4xl font-bold font-mono mb-4 text-text">Blog</h1>
20-
<p className="text-lg text-muted">Thoughts on software development, architecture, and technology.</p>
25+
<h1 className="text-4xl font-bold font-mono mb-4 text-text">{blogPageContent.title}</h1>
26+
<p className="text-lg text-muted">{blogPageContent.description}</p>
2127
</header>
2228

2329
<BlogPostList posts={posts} />

src/app/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { JetBrains_Mono, Inter } from "next/font/google";
33
import "./globals.css";
44
import { ThemeProvider } from '@/lib/theme'
55
import { ProgressBar } from '@/components/ui';
6-
import { RecaptchaProvider } from '@/components/providers/RecaptchaProvider';
6+
import { RecaptchaProvider } from '@/components/providers';
77

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

src/components/providers/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { RecaptchaProvider } from './RecaptchaProvider';

src/components/sections/ProfessionalJourney.tsx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,7 @@ import { motion, AnimatePresence } from 'framer-motion';
44
import { useEffect, useState, useCallback, useRef } from 'react';
55
import { slideInVariants, scaleVariants } from '@/lib';
66
import { useTimelineProgress } from '@/lib/hooks';
7-
8-
export interface ProfessionalMilestone {
9-
id: string;
10-
date: string;
11-
role: string;
12-
company: string;
13-
description: string;
14-
achievement: string;
15-
}
7+
import { type ProfessionalMilestone } from '@/content';
168

179
export interface ProfessionalJourneyProps {
1810
milestones?: ProfessionalMilestone[];

src/components/ui/__tests__/ContactForm.test.tsx

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -202,30 +202,7 @@ describe('ContactForm', () => {
202202
});
203203
});
204204

205-
describe('Styling and Classes', () => {
206-
it('applies correct CSS classes for styling', () => {
207-
render(<ContactForm />);
208-
209-
const container = screen.getByTestId('contact-form');
210-
expect(container).toHaveClass('bg-white', 'dark:bg-[#21262d]');
211-
212-
const submitButton = screen.getByTestId('submit-button');
213-
expect(submitButton).toHaveClass('bg-[#0969da]', 'dark:bg-[#58a6ff]');
214-
});
215205

216-
it('applies disabled styles when submitting', () => {
217-
mockUseForm.mockReturnValue([
218-
{ ...defaultFormState, submitting: true },
219-
mockHandleSubmit,
220-
mockReset
221-
]);
222-
223-
render(<ContactForm />);
224-
225-
const submitButton = screen.getByTestId('submit-button');
226-
expect(submitButton).toHaveClass('disabled:opacity-50', 'disabled:cursor-not-allowed');
227-
});
228-
});
229206

230207
describe('reCAPTCHA Integration', () => {
231208
it('renders reCAPTCHA privacy notice', () => {

src/components/ui/__tests__/Icon.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ describe("Icon", () => {
2323
expect(icon).toHaveAttribute("alt", "React icon");
2424
expect(icon).toHaveAttribute("width", "32");
2525
expect(icon).toHaveAttribute("height", "32");
26-
expect(icon).toHaveClass("custom-class");
26+
2727
});
2828

2929
it("uses default values when props are not provided", () => {

src/components/ui/__tests__/ProjectCard.test.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ describe('ProjectCard', () => {
55
const defaultProps = {
66
title: 'CCPTools Ecosystem',
77
description: 'Comprehensive nutrition platform...',
8+
technologies: [],
89
};
910

1011
it('renders with correct content', () => {

src/components/ui/__tests__/Typography.test.tsx

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,7 @@ describe('Typography', () => {
5757
expect(heading).toHaveClass('lg:text-6xl');
5858
});
5959

60-
it('combines size and custom className', () => {
61-
render(
62-
<Heading size="h3" className="custom-class">
63-
Combined Heading
64-
</Heading>
65-
);
66-
const heading = screen.getByText('Combined Heading');
67-
expect(heading).toHaveClass('text-2xl');
68-
expect(heading).toHaveClass('custom-class');
69-
});
60+
7061
});
7162

7263
describe('Text', () => {

src/content/blog-page.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
export interface BlogPageContent {
2+
title: string;
3+
description: string;
4+
navigation: {
5+
homeLink: {
6+
text: string;
7+
ariaLabel: string;
8+
};
9+
};
10+
}
11+
12+
export const blogPageContent: BlogPageContent = {
13+
title: "Blog",
14+
description: "Thoughts on software development, architecture, and technology.",
15+
navigation: {
16+
homeLink: {
17+
text: "← Home",
18+
ariaLabel: "Home"
19+
}
20+
}
21+
};

0 commit comments

Comments
 (0)