Skip to content
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

🔀 :: AuthDomainError를 API명세서와 동일하게 수정합니다 #141

Merged
merged 2 commits into from
May 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import Foundation

public enum AuthDomainError: Error {
case invalidGAuthCode
case failedToGAuthSignin
case internalServerError
}

extension AuthDomainError: LocalizedError {
public var errorDescription: String? {
switch self {
case .invalidGAuthCode:
case .failedToGAuthSignin:
return "GAuth 로그인에서 문제가 생겼습니다. 지속될 시 문의해주세요."

case .internalServerError:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ extension AuthEndpoint: SMSEndpoint {
switch self {
case .signin:
return [
400: .failedToGAuthSignin,
401: .failedToGAuthSignin,
404: .failedToGAuthSignin,
500: .internalServerError
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ final class RemoteAuthDataSourceSpy: RemoteAuthDataSource {
func login(code: String) async throws -> IsAlreadySignUp {
loginCallCount += 1
if code.isEmpty {
throw AuthDomainError.invalidGAuthCode
throw AuthDomainError.failedToGAuthSignin
}
return true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ final class AuthRepositorySpy: AuthRepository {
func login(code: String) async throws -> IsAlreadySignUp {
loginCallCount += 1
if code.isEmpty {
throw AuthDomainError.invalidGAuthCode
throw AuthDomainError.failedToGAuthSignin
}
return true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ final class LoginUseCaseSpy: LoginUseCase {
func execute(code: String) async throws -> IsAlreadySignUp {
callCount += 1
if code.isEmpty {
throw AuthDomainError.invalidGAuthCode
throw AuthDomainError.failedToGAuthSignin
}
return true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ final class AuthRepositorySpec: QuickSpec {

describe("AuthRepositoryImpl에서") {
context("code를 비운상태로 login을 실행하면") {
it("AuthDomainError.invalidGAuthCode error가 throw되고, loginCallCount가 +1 된다.") {
it("AuthDomainError.failedToGAuthSignin error가 throw되고, loginCallCount가 +1 된다.") {
await expect { try await authRepositoryImpl.login(code: "") }
.to(throwError(AuthDomainError.invalidGAuthCode))
.to(throwError(AuthDomainError.failedToGAuthSignin))

expect { remoteAuthDataSourceSpy.loginCallCount }
.to(equal(1))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ final class LoginUseCaseSpec: QuickSpec {

describe("LoginUseCase에서") {
context("code를 비운상태로 execute을 실행하면") {
it("AuthDomainError.invalidGAuthCode error가 throw되고, callCount가 +1 된다.") {
it("AuthDomainError.failedToGAuthSignin error가 throw되고, callCount가 +1 된다.") {
await expect { try await loginUseCase.execute(code: "") }
.to(throwError(AuthDomainError.invalidGAuthCode))
.to(throwError(AuthDomainError.failedToGAuthSignin))

expect { authRepositorySpy.loginCallCount }
.to(equal(1))
Expand Down