diff --git a/client/src/__test__/post/createPostDetailPath.test.ts b/client/src/__test__/post/createPostDetailPath.test.ts
new file mode 100644
index 0000000..7ce8b33
--- /dev/null
+++ b/client/src/__test__/post/createPostDetailPath.test.ts
@@ -0,0 +1,10 @@
+import {POST_DETAIL} from "@/const/clientPath";
+
+describe("createPostDetailPath 함수 테스트", () => {
+ it("postId=1 userId=thisUser 가 입력되었을 때 ", () => {
+ expect(POST_DETAIL("thisUser", "1")).toEqual("/post/@thisUser/1");
+ });
+ it("공백을 자동으로 Trim 하는지 여부", () => {
+ expect(POST_DETAIL(" thisUser", "1 ")).toEqual("/post/@thisUser/1");
+ });
+});
diff --git a/client/src/components/post/PostCard.tsx b/client/src/components/post/PostCard.tsx
index c943acd..c22e48b 100644
--- a/client/src/components/post/PostCard.tsx
+++ b/client/src/components/post/PostCard.tsx
@@ -1,6 +1,7 @@
"use client";
+import { POST_DETAIL } from "@/const/clientPath";
import { PostInterface } from "@/types/post/PostInterface";
-import createPostDetailPath from "@/utils/createPostDetailPath";
+
import { MoreVertOutlined } from "@mui/icons-material";
import {
Avatar,
@@ -25,7 +26,7 @@ const PostCard = ({
id,
}: PostInterface) => {
return (
-
+
{
+ const trimmedUserId = userId.trim();
+ const trimmedPostId = postId.trim();
+
+ return `/post/@${trimmedUserId}/${trimmedPostId}`;
+};
+
+
export default HOME;
diff --git a/client/src/utils/createPostDetailPath.test.ts b/client/src/utils/createPostDetailPath.test.ts
deleted file mode 100644
index 6cc24c5..0000000
--- a/client/src/utils/createPostDetailPath.test.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-import createPostDetailPath from "@/utils/createPostDetailPath";
-
-describe("createPostDetailPath 함수 테스트", () => {
- it("postId=1 userId=thisUser 가 입력되었을 때 ", () => {
- expect(createPostDetailPath("thisUser", "1")).toEqual("/@thisUser/1");
- });
- it("공백을 자동으로 Trim 하는지 여부", () => {
- expect(createPostDetailPath(" thisUser", "1 ")).toEqual("/@thisUser/1");
- });
-});
diff --git a/client/src/utils/createPostDetailPath.ts b/client/src/utils/createPostDetailPath.ts
deleted file mode 100644
index 508263b..0000000
--- a/client/src/utils/createPostDetailPath.ts
+++ /dev/null
@@ -1,14 +0,0 @@
-/**
- * 유저아이디와 게시글 아이디를 입력받아 /@userId/postId 형태의 String을 리턴
- * @param userId 유저ID
- * @param postId 게시글ID
- * @returns
- */
-const createPostUrl = (userId: string, postId: string) => {
- const trimmedUserId = userId.trim();
- const trimmedPostId = postId.trim();
-
- return `/@${trimmedUserId}/${trimmedPostId}`;
-};
-
-export default createPostUrl;