diff --git a/src/app/(main)/ui-preview/error-test/page.tsx b/src/app/(main)/ui-preview/error-test/page.tsx
new file mode 100644
index 0000000..2e9371a
--- /dev/null
+++ b/src/app/(main)/ui-preview/error-test/page.tsx
@@ -0,0 +1,38 @@
+"use client";
+
+import { notFound } from "next/navigation";
+import { useState, useTransition } from "react";
+
+export default function ErrorTestPage() {
+ const [error, setError] = useState(false);
+ const [isPending, startTransition] = useTransition();
+
+ if (error) {
+ throw new Error("의도적으로 발생시킨 에러입니다!");
+ }
+
+ return (
+
+
에러 테스트 페이지
+
+
+
+
+
+ );
+}
diff --git a/src/app/error.tsx b/src/app/error.tsx
new file mode 100644
index 0000000..c992058
--- /dev/null
+++ b/src/app/error.tsx
@@ -0,0 +1,5 @@
+"use client";
+
+import ErrorPage from "@/components/errors/ErrorPage";
+
+export default ErrorPage;
diff --git a/src/app/login/page.test.tsx b/src/app/login/page.test.tsx
index ce89097..ae9299a 100644
--- a/src/app/login/page.test.tsx
+++ b/src/app/login/page.test.tsx
@@ -178,6 +178,7 @@ describe("LoginPage", () => {
it("로그인 성공 후 이전 페이지 이동 테스트", async () => {
// 이전 페이지 referrer 설정
Object.defineProperty(document, "referrer", {
+ configurable: true,
value: "/auction",
writable: true,
});
diff --git a/src/app/not-found.tsx b/src/app/not-found.tsx
new file mode 100644
index 0000000..693fc33
--- /dev/null
+++ b/src/app/not-found.tsx
@@ -0,0 +1,5 @@
+"use client";
+
+import NotFoundPage from "@/components/errors/NotFoundPage";
+
+export default NotFoundPage;
diff --git a/src/components/errors/ErrorPage.test.tsx b/src/components/errors/ErrorPage.test.tsx
new file mode 100644
index 0000000..4fee784
--- /dev/null
+++ b/src/components/errors/ErrorPage.test.tsx
@@ -0,0 +1,36 @@
+import { render, screen, fireEvent } from "@testing-library/react";
+import ErrorPage from "./ErrorPage";
+
+describe("ErrorPage", () => {
+ const mockReset = jest.fn();
+ const mockError = new Error("Test Error");
+
+ beforeEach(() => {
+ mockReset.mockClear();
+ jest.spyOn(console, "error").mockImplementation(() => {});
+ });
+
+ afterEach(() => {
+ jest.restoreAllMocks();
+ });
+
+ it("렌더링 테스트", () => {
+ render(
);
+
+ expect(
+ screen.getByRole("heading", { name: "문제가 발생했습니다!" }),
+ ).toBeInTheDocument();
+ expect(
+ screen.getByRole("button", { name: "다시 시도" }),
+ ).toBeInTheDocument();
+ });
+
+ it("reset 버튼 동작 테스트", () => {
+ render(
);
+
+ const retryButton = screen.getByRole("button", { name: "다시 시도" });
+ fireEvent.click(retryButton);
+
+ expect(mockReset).toHaveBeenCalledTimes(1);
+ });
+});
diff --git a/src/components/errors/ErrorPage.tsx b/src/components/errors/ErrorPage.tsx
new file mode 100644
index 0000000..e8de4a6
--- /dev/null
+++ b/src/components/errors/ErrorPage.tsx
@@ -0,0 +1,29 @@
+"use client";
+
+import { useEffect } from "react";
+
+export default function ErrorPage({
+ error,
+ reset,
+}: {
+ error: Error & { digest?: string };
+ reset: () => void;
+}) {
+ useEffect(() => {
+ console.error(error);
+ }, [error]);
+
+ return (
+
+
+
문제가 발생했습니다!
+
+
+
+ );
+}
diff --git a/src/components/errors/NotFoundPage.test.tsx b/src/components/errors/NotFoundPage.test.tsx
new file mode 100644
index 0000000..882cd4d
--- /dev/null
+++ b/src/components/errors/NotFoundPage.test.tsx
@@ -0,0 +1,15 @@
+import { render, screen } from "@testing-library/react";
+import NotFoundPage from "./NotFoundPage";
+
+describe("NotFoundPage", () => {
+ it("렌더링 테스트", () => {
+ render(
);
+
+ expect(screen.getByText("404")).toBeInTheDocument();
+ expect(screen.getByText("페이지를 찾을 수 없습니다.")).toBeInTheDocument();
+
+ const homeLink = screen.getByRole("link", { name: "홈으로 돌아가기" });
+ expect(homeLink).toBeInTheDocument();
+ expect(homeLink).toHaveAttribute("href", "/");
+ });
+});
diff --git a/src/components/errors/NotFoundPage.tsx b/src/components/errors/NotFoundPage.tsx
new file mode 100644
index 0000000..c35bcad
--- /dev/null
+++ b/src/components/errors/NotFoundPage.tsx
@@ -0,0 +1,18 @@
+import Link from "next/link";
+
+export default function NotFoundPage() {
+ return (
+
+
+
404
+
페이지를 찾을 수 없습니다.
+
+ 홈으로 돌아가기
+
+
+
+ );
+}
diff --git a/src/components/page/auction/category.test.tsx b/src/components/page/auction/category.test.tsx
index 0354f93..0ed5f22 100644
--- a/src/components/page/auction/category.test.tsx
+++ b/src/components/page/auction/category.test.tsx
@@ -1,5 +1,5 @@
import { render, screen, fireEvent } from "@testing-library/react";
-import AuctionCategory from "./category";
+import AuctionCategory from "./Category";
const createMockProps = () => ({
selectedId: "",
diff --git a/src/components/page/auction/category.tsx b/src/components/page/auction/category.tsx
index 38255b2..be65529 100644
--- a/src/components/page/auction/category.tsx
+++ b/src/components/page/auction/category.tsx
@@ -71,7 +71,7 @@ const RecursiveCategoryItem = ({
);
};
-const AuctionCategory = ({
+export default function AuctionCategory({
selectedId,
onSelect,
expandedIds,
@@ -81,7 +81,7 @@ const AuctionCategory = ({
onSelect: (id: string) => void;
expandedIds: Set
;
onToggleExpand: (id: string) => void;
-}) => {
+}) {
return (
@@ -103,6 +103,4 @@ const AuctionCategory = ({
);
-};
-
-export default AuctionCategory;
+}
diff --git a/src/components/page/auction/list.tsx b/src/components/page/auction/list.tsx
index 674c679..4ba5d06 100644
--- a/src/components/page/auction/list.tsx
+++ b/src/components/page/auction/list.tsx
@@ -42,7 +42,7 @@ const ListItem = ({ item }: { item: AuctionItem }) => (
);
-function AuctionList({ items }: { items: AuctionItem[] }) {
+export default function AuctionList({ items }: { items: AuctionItem[] }) {
return (
);
}
-
-export default AuctionList;
diff --git a/src/components/page/auction/search.test.tsx b/src/components/page/auction/search.test.tsx
index 801eb5e..8e313b9 100644
--- a/src/components/page/auction/search.test.tsx
+++ b/src/components/page/auction/search.test.tsx
@@ -1,5 +1,5 @@
import { render, screen, fireEvent } from "@testing-library/react";
-import AuctionSearch from "./search";
+import AuctionSearch from "./Search";
import { ItemCategory } from "@/data/item-category";
const createMockPath = (): ItemCategory[] => [
diff --git a/src/components/page/auction/search.tsx b/src/components/page/auction/search.tsx
index 33fcf34..d4addab 100644
--- a/src/components/page/auction/search.tsx
+++ b/src/components/page/auction/search.tsx
@@ -5,7 +5,7 @@ import { Label } from "@/components/ui/label";
import { ItemCategory } from "@/data/item-category";
import React from "react";
-function AuctionSearch({
+export default function AuctionSearch({
path,
onCategorySelect,
}: {
@@ -42,5 +42,3 @@ function AuctionSearch({