From e9dd9dea54faf746a386f78d09f31d9911ee9d39 Mon Sep 17 00:00:00 2001 From: inyeong-kang Date: Tue, 18 Jul 2023 13:26:46 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20(#55)=20msw=EB=A1=9C=20=EA=B8=80=20?= =?UTF-8?q?=EC=9E=91=EC=84=B1/=EC=88=98=EC=A0=95=20API=20=EB=AA=A8?= =?UTF-8?q?=ED=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/mocks/handlers.ts | 3 ++- frontend/src/mocks/jero/post.ts | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 frontend/src/mocks/jero/post.ts diff --git a/frontend/src/mocks/handlers.ts b/frontend/src/mocks/handlers.ts index 5368f1e53..9beab96d3 100644 --- a/frontend/src/mocks/handlers.ts +++ b/frontend/src/mocks/handlers.ts @@ -1,4 +1,5 @@ import { example } from './example/get'; +import { createEditPostTest } from './jero/post'; import { votePostTest } from './sua/vote'; -export const handlers = [...example, ...votePostTest]; +export const handlers = [...example, ...votePostTest, ...createEditPostTest]; diff --git a/frontend/src/mocks/jero/post.ts b/frontend/src/mocks/jero/post.ts new file mode 100644 index 000000000..6d0625e9a --- /dev/null +++ b/frontend/src/mocks/jero/post.ts @@ -0,0 +1,17 @@ +import { rest } from 'msw'; + +export const createEditPostTest = [ + //게시글 작성 + rest.post('/posts', (req, res, ctx) => { + window.console.log('게시글 작성 완료', req.body); + + return res(ctx.status(201)); + }), + + //게시글 수정 + rest.put('/posts/1', (req, res, ctx) => { + window.console.log('게시글 수정 완료', req.body); + + return res(ctx.status(200)); + }), +];