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
4 changes: 2 additions & 2 deletions .agent/skills/code-review/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
name: Senior Code Reviewer
description: Analyze code for performance, security, type safety, and Next.js best practices.
triggers:
- @review
- @cr
- /review
- /cr
- "코드 리뷰해줘"
- "이 코드 문제점 있어?"
---
Expand Down
6 changes: 3 additions & 3 deletions .agent/skills/git-manager/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
name: Git Commit Manager
description: Generate semantic commit messages and manage branches.
triggers:
- @git
- @wt
- @cm
- /git
- /wt
- /cm
- "commit message"
- "커밋해줘"
---
Expand Down
4 changes: 2 additions & 2 deletions .agent/skills/notion-cms/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
name: Notion CMS Handler
description: Manage Notion API interactions, database queries, and data fetching logic.
triggers:
- @notion
- @cms
- /notion
- /cms
- "fetch post"
- "노션"
---
Expand Down
2 changes: 1 addition & 1 deletion .agent/skills/test-engineer/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: Test Engineer
description: Write and debug Unit (Vitest) and E2E (Playwright) tests.
triggers:
- @test
- /test
- "테스트 작성해줘"
- "에러 고쳐줘"
---
Expand Down
4 changes: 2 additions & 2 deletions .agent/skills/ui/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
name: UI/UX Designer
description: Design accessible, responsive, and aesthetic components using Tailwind CSS v4.
triggers:
- @ui
- @design
- /ui
- /design
- "디자인해줘"
- "예쁘게 만들어줘"
---
Expand Down
4 changes: 2 additions & 2 deletions .agent/skills/workflows/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
name: Task Finisher Workflow
description: Automate the Code Review -> Confirmation -> Git Commit pipeline.
triggers:
- @finish
- @done
- /finish
- /done
- "작업 완료"
- "마무리해줘"
---
Expand Down
21 changes: 21 additions & 0 deletions __mocks__/next-navigation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const useRouter = () => ({
push: (href) => {},
replace: (href) => {},
prefetch: (href) => {},
back: () => {},
forward: () => {},
refresh: () => {},
});

const usePathname = () => '';
const useSearchParams = () => new URLSearchParams();
const redirect = (url) => {};
const notFound = () => {};

module.exports = {
useRouter,
usePathname,
useSearchParams,
redirect,
notFound,
};
14 changes: 13 additions & 1 deletion __tests__/fixtures/sorting-data.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BlogPost } from '@/lib/types';
import { BlogPost } from '@/entities/lib/types';

/**
* Mock blog posts for sorting tests
Expand All @@ -14,6 +14,8 @@ export const mockSortingPosts: BlogPost[] = [
group: 'Group A',
viewCount: 100,
commentCount: 5,
cover: null,
description: 'Description 1'
},
{
id: '2',
Expand All @@ -25,6 +27,8 @@ export const mockSortingPosts: BlogPost[] = [
group: 'Group A',
viewCount: 250,
commentCount: 10,
cover: null,
description: 'Description 2'
},
{
id: '3',
Expand All @@ -36,6 +40,8 @@ export const mockSortingPosts: BlogPost[] = [
group: 'Group B',
viewCount: 50,
commentCount: 15,
cover: null,
description: 'Description 3'
},
{
id: '4',
Expand All @@ -47,6 +53,8 @@ export const mockSortingPosts: BlogPost[] = [
group: 'Group A',
viewCount: 1000,
commentCount: 3,
cover: null,
description: 'Description 4'
},
{
id: '5',
Expand All @@ -58,6 +66,8 @@ export const mockSortingPosts: BlogPost[] = [
group: 'Group B',
viewCount: 150,
commentCount: 50,
cover: null,
description: 'Description 5'
},
{
id: '6',
Expand All @@ -69,5 +79,7 @@ export const mockSortingPosts: BlogPost[] = [
group: 'Group C',
viewCount: 0,
commentCount: 0,
cover: null,
description: 'Description 6'
},
];
4 changes: 2 additions & 2 deletions __tests__/unit/app/actions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { fetchPosts } from '@/app/actions';
import { mockBlogPosts } from '../../fixtures/notion-data';

// Mock the getPublishedPosts function
vi.mock('@/lib/services/posts.service', () => ({
vi.mock('@/entities/lib/services/posts.service', () => ({
getPublishedPosts: vi.fn(),
}));

import { getPublishedPosts } from '@/lib/services/posts.service';
import { getPublishedPosts } from '@/entities/lib/services/posts.service';

describe('fetchPosts server action', () => {
beforeEach(() => {
Expand Down
5 changes: 3 additions & 2 deletions __tests__/unit/components/Footer.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { describe, it, expect, vi } from 'vitest';
import { render, screen } from '@testing-library/react';
import { Footer } from '@/components/utils/Footer';

import { Footer } from '@/widgets/footer';

// Mock next-intl server
vi.mock('next-intl/server', () => ({
Expand All @@ -13,7 +14,7 @@ vi.mock('next-intl/server', () => ({
}));

// Mock routing
vi.mock('@/i18n/routing', () => ({
vi.mock('@/shared/i18n/routing', () => ({
Link: ({ children, href }: { children: React.ReactNode; href: string }) => (
<a href={href}>{children}</a>
),
Expand Down
2 changes: 1 addition & 1 deletion __tests__/unit/components/GoogleAnalytics.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, it, expect } from 'vitest';
import { render } from '@testing-library/react';
import { GoogleAnalytics } from '@/components/delegator/GoogleAnalytics';
import { GoogleAnalytics } from '@/shared/lib/analytics/GoogleAnalytics';

describe('GoogleAnalytics Component', () => {
it('should render without errors when GA ID is not set', () => {
Expand Down
4 changes: 2 additions & 2 deletions __tests__/unit/components/LanguageToggle.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, it, expect, vi, beforeEach } from 'vitest';
import { render, screen, fireEvent } from '@testing-library/react';
import { LanguageToggle } from '@/components/utils/LanguageToggle';
import { LanguageToggle } from '@/features/language/ui/LanguageToggle';

// Mock the hooks
const mockUseLocale = vi.fn();
Expand All @@ -12,7 +12,7 @@ vi.mock('next-intl', () => ({
useLocale: () => mockUseLocale(),
}));

vi.mock('@/i18n/routing', () => ({
vi.mock('@/shared/i18n/routing', () => ({
useRouter: () => mockUseRouter(),
usePathname: () => mockUsePathname(),
}));
Expand Down
2 changes: 1 addition & 1 deletion __tests__/unit/components/ModeToggle.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, it, expect, vi } from 'vitest';
import { render, screen, fireEvent } from '@testing-library/react';
import { ModeToggle } from '@/components/utils/ModeToggle';
import { ModeToggle } from '@/features/theme/ui/ModeToggle';
import { useTheme } from 'next-themes';

/* eslint-disable @typescript-eslint/no-explicit-any */
Expand Down
4 changes: 2 additions & 2 deletions __tests__/unit/components/PostCard.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, it, expect, vi } from 'vitest';
import { render, screen } from '@testing-library/react';
import { PostCard } from '@/components/posts/PostCard';
import { PostCard } from '@/entities/post/ui/PostCard';
import { mockBlogPosts } from '../../fixtures/notion-data';

// Explicitly mock next/navigation to override any next-intl patching
Expand All @@ -21,7 +21,7 @@ vi.mock('next-intl', () => ({
}));

// Mock routing
vi.mock('@/i18n/routing', () => ({
vi.mock('@/shared/i18n/routing', () => ({
Link: ({ children }: { children: React.ReactNode }) => children,
}));

Expand Down
2 changes: 1 addition & 1 deletion __tests__/unit/components/PostEngagement.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { render, screen, fireEvent, waitFor } from '@testing-library/react';
import { PostEngagement } from '@/components/posts/PostEngagement';
import { PostEngagement } from '@/entities/post/ui/PostEngagement';

// Mock next-intl
vi.mock('next-intl', () => ({
Expand Down
4 changes: 2 additions & 2 deletions __tests__/unit/components/PostList.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { render, screen, waitFor, act } from '@testing-library/react';
import { PostList } from '@/components/posts/PostList';
import { PostList } from '@/widgets/post-list/ui/PostList';
import { mockBlogPosts } from '../../fixtures/notion-data';
import { fetchPosts } from '@/app/actions';

Expand All @@ -19,7 +19,7 @@ vi.mock('next/navigation', () => ({
}));

// Mock routing
vi.mock('@/i18n/routing', () => ({
vi.mock('@/shared/i18n/routing', () => ({
Link: ({ children }: { children: React.ReactNode }) => children,
}));

Expand Down
6 changes: 3 additions & 3 deletions __tests__/unit/components/Search.test.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { describe, it, expect, vi } from 'vitest';
import { render, screen, fireEvent, waitFor } from '@testing-library/react';
import { Search } from '@/components/utils/Search';
import { Search } from '@/features/search-posts/ui/Search';
import { useSearchParams } from 'next/navigation';
import { useRouter } from '@/i18n/routing';
import { useRouter } from '@/shared/i18n/routing';

/* eslint-disable @typescript-eslint/no-explicit-any */

Expand All @@ -23,7 +23,7 @@ vi.mock('next-intl', () => ({
}));

// Mock routing
vi.mock('@/i18n/routing', () => ({
vi.mock('@/shared/i18n/routing', () => ({
useRouter: vi.fn(),
}));

Expand Down
8 changes: 4 additions & 4 deletions __tests__/unit/components/SortDropdown.test.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { describe, it, expect, vi, beforeEach } from 'vitest';
import { render, screen, fireEvent } from '@testing-library/react';
import { SortDropdown } from '@/components/utils/SortDropdown';
import { SortDropdown } from '@/features/sort-posts/ui/SortDropdown';
import { useSearchParams } from 'next/navigation';
import { useRouter, usePathname } from '@/i18n/routing';
import { useRouter, usePathname } from '@/shared/i18n/routing';

/* eslint-disable @typescript-eslint/no-explicit-any */

Expand All @@ -11,8 +11,8 @@ vi.mock('next/navigation', () => ({
useSearchParams: vi.fn(),
}));

// Mock @/i18n/routing
vi.mock('@/i18n/routing', () => ({
// Mock @/shared/i18n/routing
vi.mock('@/shared/i18n/routing', () => ({
useRouter: vi.fn(),
usePathname: vi.fn(),
Link: ({ children, href, ...props }: any) => <a href={href} {...props}>{children}</a>,
Expand Down
2 changes: 1 addition & 1 deletion __tests__/unit/components/ThemeProvider.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, it, expect, vi } from 'vitest';
import { render, screen } from '@testing-library/react';
import { ThemeProvider } from '@/components/utils/ThemeProvider';
import { ThemeProvider } from '@/shared/providers/ThemeProvider';

// Mock next-themes
vi.mock('next-themes', () => ({
Expand Down
2 changes: 1 addition & 1 deletion __tests__/unit/components/ViewTracker.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { render, waitFor } from '@testing-library/react';
import { ViewTracker } from '@/components/utils/ViewTracker';
import { ViewTracker } from '@/features/track-views';

describe('ViewTracker Component', () => {
const mockFetch = vi.fn();
Expand Down
2 changes: 1 addition & 1 deletion __tests__/unit/components/notion/BlockRenderer.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, it, expect, vi } from 'vitest';
import { render, screen } from '@testing-library/react';
import { BlockRenderer } from '@/components/notion/BlockRenderer';
import { BlockRenderer } from '@/entities/notion';
import { createTestBlock } from '../../../helpers/block-test-helpers';

// Mock next/image to avoid width/height requirement in tests
Expand Down
5 changes: 2 additions & 3 deletions __tests__/unit/components/notion/TextRenderer.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, it, expect } from 'vitest';
import { render, screen } from '@testing-library/react';
import { TextRenderer } from '@/components/notion/TextRenderer';
import { TextRenderer } from '@/entities/notion';

/* eslint-disable @typescript-eslint/no-explicit-any */

Expand All @@ -18,8 +18,7 @@ describe('TextRenderer Component', () => {
});

it('should render null when text is null', () => {
// @ts-expect-error Testing null input
const { container } = render(<TextRenderer text={null} />);
const { container } = render(<TextRenderer text={null as any} />);
expect(container.innerHTML).toBe('');
});

Expand Down
2 changes: 1 addition & 1 deletion __tests__/unit/lib/notion.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { getPublishedPosts, getAllTags, getAllGroups, getTopTags, groupPosts, getPageContent, getPostById, incrementViewCount } from '@/lib/services/posts.service';
import { getPublishedPosts, getAllTags, getAllGroups, getTopTags, groupPosts, getPageContent, getPostById, incrementViewCount } from '@/entities/lib/services/posts.service';
import { mockPosts, mockBlogPosts } from '../../fixtures/notion-data';

// Hoist mocks before imports
Expand Down
13 changes: 6 additions & 7 deletions __tests__/unit/lib/posts.helper.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, it, expect, beforeEach } from 'vitest';
import { extractBlogPostFromPage, getNumberValue } from '@/lib/services/posts.helper';
import { extractBlogPostFromPage, getNumberValue } from '@/entities/lib/services/posts.helper';
import { PageObjectResponse } from '@notionhq/client/build/src/api-endpoints';

/* eslint-disable @typescript-eslint/no-explicit-any */
Expand Down Expand Up @@ -52,7 +52,7 @@ describe('posts.helper - API Response Parsing', () => {
properties: {
title: {
type: 'title',
title: [{ type: 'text', text: { content: 'Test Post' }, plain_text: 'Test Post', annotations: {} as any, href: null }],
title: [{ type: 'text', text: { content: 'Test Post', link: null }, plain_text: 'Test Post', annotations: {} as any, href: null }],
id: 'title'
},
published_date: {
Expand Down Expand Up @@ -83,8 +83,7 @@ describe('posts.helper - API Response Parsing', () => {
translation: {
type: 'relation',
relation: [{ id: 'translated-page-id' }],
id: 'translation',
has_more: false
id: 'translation'
},
view_count: {
type: 'number',
Expand All @@ -100,7 +99,8 @@ describe('posts.helper - API Response Parsing', () => {
url: 'https://notion.so/test',
public_url: null,
created_by: { object: 'user', id: 'user1' },
last_edited_by: { object: 'user', id: 'user1' }
last_edited_by: { object: 'user', id: 'user1' },
is_locked: false
};
});

Expand Down Expand Up @@ -190,8 +190,7 @@ describe('posts.helper - API Response Parsing', () => {
mockPage.properties.translation = {
type: 'relation',
relation: [],
id: 'translation',
has_more: false
id: 'translation'
};

const result = extractBlogPostFromPage(mockPage);
Expand Down
Loading