-
Notifications
You must be signed in to change notification settings - Fork 0
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
test: URLProtocol을 이용한 테스트 세팅 #97
Conversation
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.
오...Dev Log 포스팅 까지 좋은데요👍
사용 예시인 MockUserWorker 까지 작성해주셔서 잘 사용할 수 있겠어요.
찬찬히 공부해서 저도 적용해보겠습니다.
딱히 건드릴 부분이 없어보여서...이 PR은 LGTM 할게요
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.
고생하셨습니다~~ Dev Log 꼭 읽어보겠습니다~~
func modifyNickname(to nickname: String) async throws -> String { | ||
guard let fileLocation = Bundle.main.url(forResource: "PatchUserName", | ||
withExtension: "json") else { throw NetworkError.unknown } | ||
let data = try? Data(contentsOf: fileLocation) |
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.
애 물음표 떼도 괜찮지 않나요?
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.
넵 상관없을 것 같네요 !! 수정하겠습니다
bodyParameters: NicknameDTO(userName: nickname), | ||
headers: headers) | ||
let response = try await provider.request(with: endPoint) | ||
guard let data = response.data else { throw NetworkError.emptyData } |
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.
얘는 위에 데이터랑 다른 친군가요?
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.
- 윗 부분은
URLRequest
가 오면 mockdata json을 읽어서HTTPURLResponse
안에 담아주는 데이터입니다! - 밑에는
Provider
를 통해URLRequest
를 보내고 받은Reponse의 data
입니다 ! - 내부적으로는 동일한 데이터이긴 하지만, 흐름이 아예 다릅니다 !!
- 그런데 저도 보다보니까 네이밍이 살짝 헷갈리네요 이건 좀 고민해보고 수정해볼게요 ㅎㅎ
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.
위에 있는 data를 그냥 mockData라고 해줘도 괜찮을 것 같네요 ㅎㅎ
🧑🚀 PR 요약
해당 pr에서 작업한 내역을 적어주세요.
📌 변경 사항
변경사항 및 주의 사항 (모듈 설치 등)을 적어주세요.
N/A
📸 ScreenShot
작동, 구현화면
Linked Issue
close #75