-
Notifications
You must be signed in to change notification settings - Fork 0
[Feat] 마이페이지 - 프로필 수정 모달 폼 제출 테스트 코드 작성 #230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -5,6 +5,68 @@ import { User } from '@/types/service/user'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| import { createMockErrorResponse, createMockSuccessResponse } from '../common/common-mock'; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| import { mockUserItems } from './user-mock'; | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| // 1. 팔로우 등록 모킹 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const followUserMock = http.post(`*/users/follow`, async ({ request }) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const url = new URL(request.url); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const followNickname = url.searchParams.get('followNickname'); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const user = mockUserItems.find((v) => v.nickName === followNickname); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| if (user?.isFollow === false) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return HttpResponse.json( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| createMockSuccessResponse({ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ...user, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| status: 201, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| data: '팔로우 성공', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| if (user?.isFollow === null) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return HttpResponse.json( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| createMockErrorResponse({ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| status: 400, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| detail: '회원 : 자기 자신을 팔로우할 수 없습니다.', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| errorCode: 'NOT_SAME_FOLLOW', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| if (user?.isFollow === true) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return HttpResponse.json( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| createMockErrorResponse({ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| status: 400, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| detail: '회원 : 이미 팔로우 중입니다.', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| errorCode: 'ALREADY_EXIST_FOLLOW', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| // 2. 유저 프로필 변경 모킹 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const updateUserItemMock = http.patch(`*/users/profile`, async ({ request }) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const body = (await request.json()) as User; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return HttpResponse.json( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| createMockSuccessResponse({ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ...mockUserItems[0], | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ...body, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| // 4. 알림 설정 변경 모킹 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const updateMyNotificationMock = http.patch(`*/users/notification`, async ({ request }) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const url = new URL(request.url); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const isNotificationEnabled = url.searchParams.get('isNotificationEnabled'); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| return HttpResponse.json( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| createMockSuccessResponse({ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ...mockUserItems[0], | ||||||||||||||||||||||||||||||||||||||||||||||||||
| isNotificationEnabled, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
50
to
61
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 쿼리 파라미터의 타입 변환이 필요합니다. Line 59에서 🔎 수정 제안 const updateMyNotificationMock = http.patch(`*/users/notification`, async ({ request }) => {
const url = new URL(request.url);
- const isNotificationEnabled = url.searchParams.get('isNotificationEnabled');
+ const isNotificationEnabled = url.searchParams.get('isNotificationEnabled') === 'true';
return HttpResponse.json(
createMockSuccessResponse({
...mockUserItems[0],
isNotificationEnabled,
}),
);
});📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| // 5. 유저 프로필 조회 모킹 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const getUserItemMock = http.get(`*/users/:userId`, ({ params }) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const id = Number(params.userId); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const user = mockUserItems.find((item) => item.userId === id); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -23,39 +85,80 @@ const getUserItemMock = http.get(`*/users/:userId`, ({ params }) => { | |||||||||||||||||||||||||||||||||||||||||||||||||
| return HttpResponse.json(createMockSuccessResponse(user)); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| // 7. 닉네임 중복 검사 모킹 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const getNicknameAvailabilityMock = http.get(`*/users/nickname/availability`, ({ request }) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const url = new URL(request.url); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const nickname = url.searchParams.get('nickname'); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const user = mockUserItems.find((item) => item.nickName === nickname); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return HttpResponse.json( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| createMockSuccessResponse({ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| data: { available: !user }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+82
to
+92
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 응답 구조가 API 타입 정의와 일치하지 않습니다. Line 94-96에서 🔎 수정 제안 const getNicknameAvailabilityMock = http.get(`*/users/nickname/availability`, ({ request }) => {
const url = new URL(request.url);
- const nickname = url.searchParams.get('nickname');
+ const nickName = url.searchParams.get('nickName');
- const user = mockUserItems.find((item) => item.nickName === nickname);
+ const user = mockUserItems.find((item) => item.nickName === nickName);
return HttpResponse.json(
- createMockSuccessResponse({
- data: { available: !user },
- }),
+ createMockSuccessResponse({ available: !user }),
);
});참고: 파라미터 이름도 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| // 8. 본인 프로필 조회 모킹 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const getMeItemMock = http.get(`*/users/me`, () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const id = 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const user = mockUserItems.find((item) => item.userId === id); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return HttpResponse.json(createMockSuccessResponse(user)); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| const updateUserItemMock = http.patch(`*/users`, async ({ request }) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const body = (await request.json()) as User; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| // 7. 닉네임 중복 검사 모킹 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const getEmailAvailabilityMock = http.get(`*/users/email/availability`, ({ request }) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const url = new URL(request.url); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const email = url.searchParams.get('email'); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const user = mockUserItems.find((item) => item.email === email); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return HttpResponse.json( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| createMockSuccessResponse({ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ...mockUserItems[0], | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ...body, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| data: { available: !user }, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+101
to
111
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 응답 구조가 일관되지 않습니다. Line 113-115에서 getNicknameAvailabilityMock과 동일한 불필요한 중첩 구조 문제가 있습니다. 🔎 수정 제안-const getEmailAvailabilityMock = http.get(`*/users/email/availability`, ({ request }) => {
+const getEmailAvailabilityMock = http.get(`*/users/email/availability`, ({ request }) => {
const url = new URL(request.url);
const email = url.searchParams.get('email');
const user = mockUserItems.find((item) => item.email === email);
return HttpResponse.json(
- createMockSuccessResponse({
- data: { available: !user },
- }),
+ createMockSuccessResponse({ available: !user }),
);
});📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| const deleteUserItemMock = http.delete(`*/users`, async () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return HttpResponse.json(createMockSuccessResponse(null)); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const unfollowUserMock = http.delete(`*/users/unfollow`, ({ request }) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const url = new URL(request.url); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const unFollowNickname = url.searchParams.get('unFollowNickname'); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| const user = mockUserItems.find((v) => v.nickName === unFollowNickname); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| const followUserItemMock = http.post(`*/follows`, async () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return HttpResponse.json(createMockSuccessResponse(null)); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| if (user?.isFollow === false) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return HttpResponse.json( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| createMockSuccessResponse({ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ...user, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| status: 200, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| data: '팔로우 취소 성공', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| const unfollowUserItemMock = http.delete(`*/follows/:followId`, async () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return HttpResponse.json(createMockSuccessResponse(null)); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| if (user?.isFollow === null) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return HttpResponse.json( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| createMockErrorResponse({ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| status: 400, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| detail: '회원 : 팔로우 취소 대상은 본인 될 수 없습니다.', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| errorCode: 'NOT_SAME_FOLLOW', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| if (user?.isFollow === true) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| return HttpResponse.json( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| createMockErrorResponse({ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| status: 400, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| detail: '회원 : 팔로우 관계를 찾을 수 없습니다.', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| errorCode: 'NOT_FOUND_FOLLOW', | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }), | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
113
to
141
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 언팔로우 상태 로직이 반대로 구현되어 있습니다. Line 124에서
🔎 수정 제안 const unfollowUserMock = http.delete(`*/users/unfollow`, ({ request }) => {
const url = new URL(request.url);
const unFollowNickname = url.searchParams.get('unFollowNickname');
const user = mockUserItems.find((v) => v.nickName === unFollowNickname);
+
+ if (!user) {
+ return HttpResponse.json(
+ createMockErrorResponse({
+ status: 404,
+ detail: '존재하지 않는 사용자입니다.',
+ errorCode: 'USER_NOT_FOUND',
+ }),
+ { status: 404 },
+ );
+ }
- if (user?.isFollow === false) {
+ if (user.nickName === mockUserItems[0].nickName) {
+ return HttpResponse.json(
+ createMockErrorResponse({
+ status: 400,
+ detail: '회원 : 팔로우 취소 대상은 본인이 될 수 없습니다.',
+ errorCode: 'NOT_SAME_FOLLOW',
+ }),
+ { status: 400 },
+ );
+ }
+
+ if (user.isFollow === true) {
+ // 언팔로우 상태 업데이트 (실제로는 mockUserItems 업데이트 필요)
return HttpResponse.json(
- createMockSuccessResponse({
- ...user,
- status: 200,
- data: '팔로우 취소 성공',
- }),
+ createMockSuccessResponse('팔로우 취소 성공'),
);
}
- if (user?.isFollow === null) {
- return HttpResponse.json(
- createMockErrorResponse({
- status: 400,
- detail: '회원 : 팔로우 취소 대상은 본인 될 수 없습니다.',
- errorCode: 'NOT_SAME_FOLLOW',
- }),
- );
- }
-
- if (user?.isFollow === true) {
+ if (user.isFollow === false) {
return HttpResponse.json(
createMockErrorResponse({
status: 400,
detail: '회원 : 팔로우 관계를 찾을 수 없습니다.',
errorCode: 'NOT_FOUND_FOLLOW',
}),
+ { status: 400 },
);
}
});
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| export const userHandlers = [ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| followUserMock, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| getUserItemMock, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| updateMyNotificationMock, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| getMeItemMock, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| updateUserItemMock, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| deleteUserItemMock, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| followUserItemMock, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| unfollowUserItemMock, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| getNicknameAvailabilityMock, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| getEmailAvailabilityMock, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| unfollowUserMock, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
팔로우 상태 로직이 반대로 구현되어 있습니다.
현재 구현에서
isFollow === false일 때 "팔로우 성공"을 반환하고 있지만, 이는 반대입니다:isFollow === false: 이미 팔로우하지 않은 상태 → 팔로우를 추가해야 함 ✅isFollow === true: 이미 팔로우 중 → 에러를 반환해야 함 ✅하지만 실제 팔로우 로직과 상태 업데이트가 누락되어 있습니다. 현재는 단순히 기존 user 객체를 반환만 하고,
isFollow상태를true로 변경하지 않습니다.🔎 수정 제안
const followUserMock = http.post(`*/users/follow`, async ({ request }) => { const url = new URL(request.url); const followNickname = url.searchParams.get('followNickname'); const user = mockUserItems.find((v) => v.nickName === followNickname); + + if (!user) { + return HttpResponse.json( + createMockErrorResponse({ + status: 404, + detail: '존재하지 않는 사용자입니다.', + errorCode: 'USER_NOT_FOUND', + }), + { status: 404 }, + ); + } - if (user?.isFollow === false) { + if (user.isFollow === false) { + // 팔로우 상태 업데이트 (실제로는 mockUserItems 업데이트 필요) return HttpResponse.json( - createMockSuccessResponse({ - ...user, - status: 201, - data: '팔로우 성공', - }), + createMockSuccessResponse('팔로우 성공'), + { status: 201 }, ); } - if (user?.isFollow === null) { + if (user.nickName === mockUserItems[0].nickName) { return HttpResponse.json( createMockErrorResponse({ status: 400, detail: '회원 : 자기 자신을 팔로우할 수 없습니다.', errorCode: 'NOT_SAME_FOLLOW', }), + { status: 400 }, ); } - if (user?.isFollow === true) { + if (user.isFollow === true) { return HttpResponse.json( createMockErrorResponse({ status: 400, detail: '회원 : 이미 팔로우 중입니다.', errorCode: 'ALREADY_EXIST_FOLLOW', }), + { status: 400 }, ); } });There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
해당 로직에 오류가 있었습니다.
기존 createMockSuccessReponse 함수가 아래와 같이 구성되어있기 때문에,
아래와 같이 팔로우 성공 응답을 수정하려고 합니다.
실제 api에서 팔로우를 성공할 때 user data를 반환하지 않습니다.
또한, isFollow가 false일때만 팔로우 요청이 성공해야하기 때문에 이 방식이 맞습니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Chiman2937, 설명해주셔서 감사합니다!
isFollow === false가 "현재 팔로우하지 않은 상태"를 의미한다는 점과 실제 API가 팔로우 성공 시 사용자 데이터를 반환하지 않는다는 점을 이해했습니다.제안하신 방식이 실제 API 동작과 일치하므로 적절합니다:
한 가지 추가로 고려할 점은, 현재 mock은
mockUserItems배열의isFollow상태를 업데이트하지 않기 때문에, 동일 테스트 내에서 연속적으로 팔로우 상태를 확인하는 경우 이전 상태가 유지됩니다. 테스트 시나리오에서 상태 지속성이 필요하지 않다면 현재 구현으로 충분합니다.✏️ Learnings added