Repository navigation
클래스 API 계약 테스트를 현재 모듈 구조에 맞춤 #77
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 all commits
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 |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| @testable import ClassDomain | ||
| import APIEndpoint | ||
|
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. 🟠 [P2] Major
|
||
| import ClassDomainInterface | ||
| import Foundation | ||
| import PickeNetwork | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| @testable import ClassDomain | ||
| import APIEndpoint | ||
|
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. 🟠 [P2] Major
|
||
| import ClassDomainInterface | ||
| import Foundation | ||
| import PickeNetwork | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| @testable import ClassDomain | ||
| import APIEndpoint | ||
|
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. 🟠 [P2] Major
|
||
| import ClassDomainInterface | ||
| import Foundation | ||
| import PickeNetwork | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| @testable import ClassDomain | ||
| import APIEndpoint | ||
| import ClassDomainInterface | ||
| import Dependencies | ||
| import Foundation | ||
|
|
@@ -67,13 +68,11 @@ struct ClassRecommendationTests { | |
| @Test | ||
| func 라이브_클래스_목록은_목_저장소가_아닌_서버를_쓴다() async throws { | ||
| let json = #"{"statusCode":200,"data":[]}"# | ||
| let live = ClassLiveRepository( | ||
| api: withDependencies { | ||
| $0.networkClient = ClassRecommendationStubClient(data: Data(json.utf8)) | ||
| } operation: { | ||
| ClassRepositoryImpl() | ||
| } | ||
| ) | ||
| let live = withDependencies { | ||
|
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. 🟡 [P3] Minor
|
||
| $0.networkClient = ClassRecommendationStubClient(data: Data(json.utf8)) | ||
| } operation: { | ||
| ClassRepositoryImpl() | ||
| } | ||
|
|
||
| #expect(try await live.fetchMyClasses().isEmpty) | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,24 @@ | ||
| @testable import ClassDomain | ||
| import APIEndpoint | ||
|
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. 🟠 [P2] Major
|
||
| import ClassDomainInterface | ||
| import Foundation | ||
| import PickeCoreUtility | ||
| import PickeNetwork | ||
| import Testing | ||
|
|
||
| struct ClassResultAPIContractTests { | ||
| @Test | ||
| func 결과_열람_만료와_권한_오류를_구분한다() { | ||
| #expect(ClassResultRepositoryImpl.resultError(code: "CLASS_409_RESULT_EXPIRED", message: nil) == .resultExpired) | ||
| #expect(ClassResultRepositoryImpl.resultError(code: "CLASS_403_MEMBER", message: nil) == .accessDenied) | ||
| #expect(ClassResultRepositoryImpl.feedbackError(code: "CLASS_409_RESULT_EXPIRED") == .resultExpired) | ||
| #expect(ClassResultRepositoryImpl.feedbackError(code: "CLASS_403_OWNER") == .accessDenied) | ||
| #expect(ClassResultRepositoryImpl.feedbackError(code: "CLASS_409_REPORT_RETRY") == .generationFailed) | ||
| #expect(ClassRepositoryImpl.resultError(code: "CLASS_409_RESULT_EXPIRED", message: nil) == .resultExpired) | ||
| #expect(ClassRepositoryImpl.resultError(code: "CLASS_403_MEMBER", message: nil) == .accessDenied) | ||
| #expect(ClassRepositoryImpl.feedbackError(code: "CLASS_409_RESULT_EXPIRED") == .resultExpired) | ||
| #expect(ClassRepositoryImpl.feedbackError(code: "CLASS_403_OWNER") == .accessDenied) | ||
| #expect(ClassRepositoryImpl.feedbackError(code: "CLASS_409_REPORT_RETRY") == .generationFailed) | ||
| } | ||
|
|
||
| @Test | ||
| func 감싼_네트워크_디코딩_오류는_재시도_대상에서_제외한다() { | ||
| let error = ClassResultRepositoryImpl.feedbackError(PickeNetworkError.decoding(.dataMissing)) | ||
| let error = ClassRepositoryImpl.feedbackError(PickeNetworkError.decoding(.dataMissing)) | ||
| #expect(error == .invalidResponse) | ||
| #expect(!error.isRetryable) | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| @testable import ClassDomain | ||
| import APIEndpoint | ||
|
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. 🟠 [P2] Major
|
||
| import ClassDomainInterface | ||
| import Foundation | ||
| import PickeCoreUtility | ||
|
|
@@ -22,7 +23,7 @@ struct ClassTicketAPITests { | |
| let error = PickeNetworkError.response( | ||
| ResponseError(httpStatus: status, code: code) | ||
| ) | ||
| #expect(ClassTicketRepositoryImpl.map(error) == expected) | ||
| #expect(ClassRepositoryImpl.ticketError(error) == expected) | ||
| } | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| @testable import ClassDomain | ||
| import ClassDomainInterface | ||
| import APIEndpoint | ||
|
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. 🟠 [P2] Major
|
||
| import Foundation | ||
| import PickeNetwork | ||
| import Testing | ||
|
|
||
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.
🔵 [P4] Readability
FeedbackUseCaseStub은 구조체로 선언되었으므로final을 사용할 수 없습니다. 그러나private가시성을 고려할 때, 이 타입을class로 변경하여final로 선언하는 것을 고려할 수 있습니다.struct로 유지하는 것이 의도된 설계라면 이 코멘트는 무시해도 좋습니다.