diff --git a/Projects/Features/SignupFeature/Sources/SignupTerms/SignupTermsParam.swift b/Projects/Features/SignupFeature/Sources/SignupTerms/SignupTermsParam.swift index 062fd87f..0eef778e 100644 --- a/Projects/Features/SignupFeature/Sources/SignupTerms/SignupTermsParam.swift +++ b/Projects/Features/SignupFeature/Sources/SignupTerms/SignupTermsParam.swift @@ -6,7 +6,6 @@ public struct SignupTermsParam: Equatable { profileImageURLString: String? ) { self.schoolCode = signupProfileImageParam.schoolCode - self.schoolID = signupProfileImageParam.schoolID self.schoolAnswer = signupProfileImageParam.schoolAnswer self.email = signupProfileImageParam.email self.authCode = signupProfileImageParam.authCode @@ -19,7 +18,6 @@ public struct SignupTermsParam: Equatable { } public let schoolCode: String - public let schoolID: String public let schoolAnswer: String public let email: String public let authCode: String diff --git a/Projects/Features/SignupFeature/Sources/SignupTerms/SignupTermsView.swift b/Projects/Features/SignupFeature/Sources/SignupTerms/SignupTermsView.swift index f14bef92..1f8b421c 100644 --- a/Projects/Features/SignupFeature/Sources/SignupTerms/SignupTermsView.swift +++ b/Projects/Features/SignupFeature/Sources/SignupTerms/SignupTermsView.swift @@ -53,13 +53,18 @@ struct SignupTermsView: View { ) } .dmsBackButton(dismiss: dismiss) - .dmsToast(isShowing: $viewModel.isErrorOcuured, message: viewModel.errorMessage, style: .error) .padding(.horizontal, 24) .dmsBackground() + .dmsToast(isShowing: $viewModel.isErrorOcuured, message: viewModel.errorMessage, style: .error) .alert(viewModel.alertMessage, isPresented: $viewModel.isShowingAlert) { Button("확인", role: .cancel) { appState.sceneFlow = . main } } + .onChange(of: viewModel.dmsFeatures) { newValue in + if let newValue { + appState.features = newValue + } + } } } diff --git a/Projects/Features/SignupFeature/Sources/SignupTerms/SignupTermsViewModel.swift b/Projects/Features/SignupFeature/Sources/SignupTerms/SignupTermsViewModel.swift index 21522914..9d81832a 100644 --- a/Projects/Features/SignupFeature/Sources/SignupTerms/SignupTermsViewModel.swift +++ b/Projects/Features/SignupFeature/Sources/SignupTerms/SignupTermsViewModel.swift @@ -6,6 +6,7 @@ final class SignupTermsViewModel: BaseViewModel { @Published var isAgreeTerms = false @Published var isShowingAlert = false @Published var alertMessage = "" + @Published var dmsFeatures: DmsFeatures? private let signupUseCase: any SignupUseCase let signupTermsParam: SignupTermsParam @@ -34,8 +35,11 @@ final class SignupTermsViewModel: BaseViewModel { profileImageUrl: signupTermsParam.profileImageURLString ) ) - ) { [weak self] _ in + ) { [weak self] feature in + self?.dmsFeatures = feature self?.isShowingAlert = true + print("thisis") + print(self?.dmsFeatures?.remainService ?? "failed parsing") self?.alertMessage = "회원가입이 완료되었습니다!" } } diff --git a/Projects/Modules/ErrorModule/Sources/DmsError.swift b/Projects/Modules/ErrorModule/Sources/DmsError.swift index eb66a0ea..ada38cbc 100644 --- a/Projects/Modules/ErrorModule/Sources/DmsError.swift +++ b/Projects/Modules/ErrorModule/Sources/DmsError.swift @@ -24,6 +24,7 @@ public enum DmsError: Error { case notFoundAccountID // MARK: - Students + case unAuthorizedEmail case alreadyExistUserBySignup case alreadyExistIDByCheckID case alreadyExistEmailByCheckEmail @@ -86,7 +87,7 @@ extension DmsError: LocalizedError { return "인증 정보를 찾을 수 없습니다." case .diffrentEmailByAccountID: - return "아이디외 이메일과 일치하지 않습니다." + return "아이디와 이메일이 일치하지 않습니다." case .notFoundAccountID: return "존재하지 않는 아이디입니다." @@ -95,6 +96,8 @@ extension DmsError: LocalizedError { return "학생이 등록되지 않았습니다." // MARK: - Students + case .unAuthorizedEmail: + return "이메일이 인증되지 않았습니다." case .alreadyExistUserBySignup: return "이미 회원가입한 학생합니다!" diff --git a/Projects/Services/APIKit/Sources/StudentsAPI.swift b/Projects/Services/APIKit/Sources/StudentsAPI.swift index b3c02fe9..0e4a106a 100644 --- a/Projects/Services/APIKit/Sources/StudentsAPI.swift +++ b/Projects/Services/APIKit/Sources/StudentsAPI.swift @@ -127,7 +127,9 @@ extension StudentsAPI: DmsAPI { case .signup: return [ 400: .badRequest, + 401: .unAuthorizedEmail, 409: .alreadyExistUserBySignup, + 429: .tooManyRequest, 500: .internalServerError ] @@ -206,6 +208,8 @@ extension StudentsAPI: DmsAPI { "school_name" : "광주소프트웨어마이스터고등학교", "name" : "변찬우", "gcn" : "2118", + "profile_image_url": "", + "sex": "MALE", "bonus_point" : 0, "minus_point" : 24, "phrase" : "안녕하세요 프론트하는 변찬우입니다" diff --git a/Projects/Services/DataMappingModule/Sources/Base/DmsFeaturesResponseDTO.swift b/Projects/Services/DataMappingModule/Sources/Base/DmsFeaturesResponseDTO.swift index 9ba5f522..94507795 100644 --- a/Projects/Services/DataMappingModule/Sources/Base/DmsFeaturesResponseDTO.swift +++ b/Projects/Services/DataMappingModule/Sources/Base/DmsFeaturesResponseDTO.swift @@ -5,10 +5,16 @@ public struct DmsFeaturesResponseDTO: Decodable { } public struct DmsFeaturesDTO: Decodable { + public let mealService: Bool + public let noticeService: Bool + public let pointService: Bool public let studyRoomService: Bool public let remainService: Bool enum CodingKeys: String, CodingKey { + case mealService = "meal_service" + case noticeService = "notice_service" + case pointService = "point_service" case studyRoomService = "study_room_service" case remainService = "remain_service" } diff --git a/Projects/Services/DataModule/Sources/Auth/Repositories/Stub/AuthRepositoryStub.swift b/Projects/Services/DataModule/Sources/Auth/Repositories/Stub/AuthRepositoryStub.swift index 3b9d2acc..271d2976 100644 --- a/Projects/Services/DataModule/Sources/Auth/Repositories/Stub/AuthRepositoryStub.swift +++ b/Projects/Services/DataModule/Sources/Auth/Repositories/Stub/AuthRepositoryStub.swift @@ -9,9 +9,15 @@ public struct AuthRepositoryStub: AuthRepository { public func logout() {} public func signin(req: SigninRequestDTO) -> AnyPublisher { - Just(DmsFeatures(studyRoomService: false, remainService: false )) - .setFailureType(to: DmsError.self) - .eraseToAnyPublisher() + Just(DmsFeatures( + mealService: true, + noticeService: true, + pointService: true, + studyRoomService: false, + remainService: false + )) + .setFailureType(to: DmsError.self) + .eraseToAnyPublisher() } public func verifyAuthCode(req: VerifyAuthCodeRequestDTO) -> AnyPublisher { @@ -25,9 +31,15 @@ public struct AuthRepositoryStub: AuthRepository { } public func reissueToken() -> AnyPublisher { - Just(DmsFeatures(studyRoomService: false, remainService: false)) - .setFailureType(to: DmsError.self) - .eraseToAnyPublisher() + Just(DmsFeatures( + mealService: true, + noticeService: true, + pointService: true, + studyRoomService: false, + remainService: false + )) + .setFailureType(to: DmsError.self) + .eraseToAnyPublisher() } public func checkEmailExistByAccountID(req: EmailExistByAccountIDRequestDTO) -> AnyPublisher { diff --git a/Projects/Services/DataModule/Sources/Auth/UseCases/Fake/SigninUseCaseFake.swift b/Projects/Services/DataModule/Sources/Auth/UseCases/Fake/SigninUseCaseFake.swift new file mode 100644 index 00000000..34aaa94c --- /dev/null +++ b/Projects/Services/DataModule/Sources/Auth/UseCases/Fake/SigninUseCaseFake.swift @@ -0,0 +1,28 @@ +import Combine +import DataMappingModule +import DomainModule +import ErrorModule +import Foundation + +public struct SigninUseCaseFake: SigninUseCase { + public init () {} + + public func execute(req: SigninRequestDTO) -> AnyPublisher { + if req.accountID == "baekteun" && req.password == "baekteun" { + return Just(DmsFeatures( + mealService: true, + noticeService: true, + pointService: true, + studyRoomService: false, + remainService: false + )) + .setFailureType(to: DmsError.self) + .delay(for: 1, scheduler: DispatchQueue.main) + .eraseToAnyPublisher() + } else { + return Fail(error: DmsError.passwordMismatch) + .delay(for: 1, scheduler: DispatchQueue.main) + .eraseToAnyPublisher() + } + } +} diff --git a/Projects/Services/DataModule/Sources/Students/Repositories/Impl/StudentsRepositoryImpl.swift b/Projects/Services/DataModule/Sources/Students/Repositories/Impl/StudentsRepositoryImpl.swift index a3f12365..91ed48ee 100644 --- a/Projects/Services/DataModule/Sources/Students/Repositories/Impl/StudentsRepositoryImpl.swift +++ b/Projects/Services/DataModule/Sources/Students/Repositories/Impl/StudentsRepositoryImpl.swift @@ -11,7 +11,7 @@ public struct StudentsRepositoryImpl: StudentsRepository { self.remoteStudentsDataSource = remoteStudentsDataSource } - public func signup(req: SignupRequestDTO) -> AnyPublisher { + public func signup(req: SignupRequestDTO) -> AnyPublisher { remoteStudentsDataSource.signup(req: req) } diff --git a/Projects/Services/DataModule/Sources/Students/Repositories/Stub/StudentsRepositoryStub.swift b/Projects/Services/DataModule/Sources/Students/Repositories/Stub/StudentsRepositoryStub.swift index bcc502a3..5ecc1051 100644 --- a/Projects/Services/DataModule/Sources/Students/Repositories/Stub/StudentsRepositoryStub.swift +++ b/Projects/Services/DataModule/Sources/Students/Repositories/Stub/StudentsRepositoryStub.swift @@ -8,9 +8,16 @@ import Foundation public struct StudentsRepositoryStub: StudentsRepository { public init() {} - public func signup(req: SignupRequestDTO) -> AnyPublisher { - Just(()).setFailureType(to: DmsError.self) - .eraseToAnyPublisher() + public func signup(req: SignupRequestDTO) -> AnyPublisher { + Just(DmsFeatures( + mealService: true, + noticeService: true, + pointService: true, + studyRoomService: false, + remainService: false + )) + .setFailureType(to: DmsError.self) + .eraseToAnyPublisher() } public func checkDuplicateAccountID(id: String) -> AnyPublisher { diff --git a/Projects/Services/DataModule/Sources/Students/UseCases/Fake/SignupUseCaseFake.swift b/Projects/Services/DataModule/Sources/Students/UseCases/Fake/SignupUseCaseFake.swift new file mode 100644 index 00000000..9153db49 --- /dev/null +++ b/Projects/Services/DataModule/Sources/Students/UseCases/Fake/SignupUseCaseFake.swift @@ -0,0 +1,28 @@ +import Combine +import DataMappingModule +import DomainModule +import ErrorModule +import Foundation + +public struct SignupUseCaseFake: SignupUseCase { + public init () {} + + public func execute(req: SignupRequestDTO) -> AnyPublisher { + if req.accountID == "baekteun" && req.password == "baekteun" { + return Just(DmsFeatures( + mealService: true, + noticeService: true, + pointService: true, + studyRoomService: false, + remainService: false + )) + .setFailureType(to: DmsError.self) + .delay(for: 1, scheduler: DispatchQueue.main) + .eraseToAnyPublisher() + } else { + return Fail(error: DmsError.passwordMismatch) + .delay(for: 1, scheduler: DispatchQueue.main) + .eraseToAnyPublisher() + } + } +} diff --git a/Projects/Services/DataModule/Sources/Students/UseCases/Impl/SignupUseCaseImpl.swift b/Projects/Services/DataModule/Sources/Students/UseCases/Impl/SignupUseCaseImpl.swift index 9f299794..f2edbe67 100644 --- a/Projects/Services/DataModule/Sources/Students/UseCases/Impl/SignupUseCaseImpl.swift +++ b/Projects/Services/DataModule/Sources/Students/UseCases/Impl/SignupUseCaseImpl.swift @@ -10,7 +10,7 @@ public struct SignupUseCaseImpl: SignupUseCase { self.studentsRepository = studentsRepository } - public func execute(req: SignupRequestDTO) -> AnyPublisher { + public func execute(req: SignupRequestDTO) -> AnyPublisher { studentsRepository.signup(req: req) } } diff --git a/Projects/Services/DataModule/Tests/Auth/Repository/AuthRepositoryImplSpec.swift b/Projects/Services/DataModule/Tests/Auth/Repository/AuthRepositoryImplSpec.swift index cf6ea5a2..707d433e 100644 --- a/Projects/Services/DataModule/Tests/Auth/Repository/AuthRepositoryImplSpec.swift +++ b/Projects/Services/DataModule/Tests/Auth/Repository/AuthRepositoryImplSpec.swift @@ -4,6 +4,8 @@ import Combine import DomainModule import DataModule import NetworkModule +import DatabaseModule +@testable import KeychainModule // swiftlint: disable function_body_length final class AuthRepositoryImplSpec: QuickSpec { @@ -14,27 +16,12 @@ final class AuthRepositoryImplSpec: QuickSpec { beforeEach { remoteAuthDS = RemoteAuthDataSourceStub() - sut = AuthRepositoryImpl(remoteAuthDataSource: remoteAuthDS) + sut = AuthRepositoryImpl( + remoteAuthDataSource: remoteAuthDS, + localAuthDataSource: LocalAuthDataSourceImpl(keychain: KeychainFake()) + ) } describe("AuthRepositoryImpl에서") { - context("signin()를 실행하면") { - it("request를 성공적으로 실행한다.") { - var success: Void? - var res: DmsFeatures? - sut.signin(req: .init(accountID: "", password: "")) - .sink { _ in } receiveValue: { item in - success = () - res = item - } - .store(in: &bag) - expect { success }.toNotEventually(beNil()) - expect { success }.toEventually(beVoid()) - expect { res }.toNot(beNil()) - expect { res?.mealService }.to(beFalse()) - expect { res?.noticeService }.to(beFalse()) - expect { res?.pointService }.to(beFalse()) - } - } context("verifyAuthCode()를 실행하면") { it("request를 성공적으로 실행한다.") { var success: Void? diff --git a/Projects/Services/DataModule/Tests/Auth/UseCase/SigninUseCaseImplSpec.swift b/Projects/Services/DataModule/Tests/Auth/UseCase/SigninUseCaseImplSpec.swift index 62e816ac..15fcfc5b 100644 --- a/Projects/Services/DataModule/Tests/Auth/UseCase/SigninUseCaseImplSpec.swift +++ b/Projects/Services/DataModule/Tests/Auth/UseCase/SigninUseCaseImplSpec.swift @@ -15,24 +15,6 @@ final class SigninUseCaseImplSpec: QuickSpec { sut = SigninUseCaseImpl(authRepository: repo) } describe("SigninUseCaseImpl에서") { - context("execute()를 실행하면") { - it("request를 성공적으로 실행한다.") { - var success: Void? - var res: DmsFeatures? - sut.execute(req: .init(accountID: "", password: "")) - .sink { _ in } receiveValue: { item in - success = () - res = item - } - .store(in: &bag) - expect { success }.toNotEventually(beNil()) - expect { success }.toEventually(beVoid()) - expect { res }.toNot(beNil()) - expect { res?.mealService }.to(beFalse()) - expect { res?.noticeService }.to(beFalse()) - expect { res?.pointService }.to(beFalse()) - } - } } } } diff --git a/Projects/Services/DataModule/Tests/Students/Repository/StudentsRepositoryImplSpec.swift b/Projects/Services/DataModule/Tests/Students/Repository/StudentsRepositoryImplSpec.swift index 0aa83728..ffe467ad 100644 --- a/Projects/Services/DataModule/Tests/Students/Repository/StudentsRepositoryImplSpec.swift +++ b/Projects/Services/DataModule/Tests/Students/Repository/StudentsRepositoryImplSpec.swift @@ -19,7 +19,7 @@ final class StudentsRepositoryImplSpec: QuickSpec { describe("StudentsRepositoryImpl에서") { context("signup()을 실행하면") { it("request를 성공적으로 실행한다.") { - var success: Void? + var success: DmsFeatures? sut.signup( req: .init( schoolCode: "", @@ -91,7 +91,7 @@ final class StudentsRepositoryImplSpec: QuickSpec { expect { success }.toNotEventually(beNil()) expect { success }.toEventually(beVoid()) expect { res }.toNotEventually(beNil()) - expect { res }.toEventually(equal("abc*****@gmail.com")) + expect { res }.toEventually(equal("abcdef@gmail.com")) } } context("fetchMyProfile()을 실행하면") { @@ -112,7 +112,7 @@ final class StudentsRepositoryImplSpec: QuickSpec { expect { res!.gcn }.toEventually(equal("2118")) expect { res!.bonusPoint }.toEventually(equal(0)) expect { res!.minusPoint }.toEventually(equal(24)) - expect { res!.phrase }.toEventually(equal("안녕하세요")) + expect { res!.phrase }.toEventually(equal("벌점이 12점이예요. 더 바른 생활을 위해 노력해주세요!")) } } } diff --git a/Projects/Services/DataModule/Tests/Students/UseCase/SignupUseCaseImplSpec.swift b/Projects/Services/DataModule/Tests/Students/UseCase/SignupUseCaseImplSpec.swift index c94aaa69..20f0f773 100644 --- a/Projects/Services/DataModule/Tests/Students/UseCase/SignupUseCaseImplSpec.swift +++ b/Projects/Services/DataModule/Tests/Students/UseCase/SignupUseCaseImplSpec.swift @@ -17,7 +17,7 @@ final class SignupUseCaseImplSpec: QuickSpec { describe("SignupUseCaseImpl에서") { context("execute()를 실행하면") { it("request를 성공적으로 실행한다.") { - var success: Void? + var success: DmsFeatures? sut.execute( req: .init( schoolCode: "", diff --git a/Projects/Services/DomainModule/Sources/Entities/DmsFeatures.swift b/Projects/Services/DomainModule/Sources/Entities/DmsFeatures.swift index 8f5913fe..ac603729 100644 --- a/Projects/Services/DomainModule/Sources/Entities/DmsFeatures.swift +++ b/Projects/Services/DomainModule/Sources/Entities/DmsFeatures.swift @@ -2,18 +2,30 @@ import Foundation public struct DmsFeatures: Equatable { public init( + mealService: Bool, + noticeService: Bool, + pointService: Bool, studyRoomService: Bool, remainService: Bool ) { + self.mealService = mealService + self.noticeService = noticeService + self.pointService = pointService self.studyRoomService = studyRoomService self.remainService = remainService } public init() { + self.mealService = false + self.noticeService = false + self.pointService = false self.studyRoomService = false self.remainService = false } + public let mealService: Bool + public let noticeService: Bool + public let pointService: Bool public let studyRoomService: Bool public let remainService: Bool } diff --git a/Projects/Services/DomainModule/Sources/Students/Repository/StudentsRepository.swift b/Projects/Services/DomainModule/Sources/Students/Repository/StudentsRepository.swift index f560fb9e..a66e66cd 100644 --- a/Projects/Services/DomainModule/Sources/Students/Repository/StudentsRepository.swift +++ b/Projects/Services/DomainModule/Sources/Students/Repository/StudentsRepository.swift @@ -3,7 +3,7 @@ import DataMappingModule import ErrorModule public protocol StudentsRepository { - func signup(req: SignupRequestDTO) -> AnyPublisher + func signup(req: SignupRequestDTO) -> AnyPublisher func checkDuplicateAccountID(id: String) -> AnyPublisher func checkDuplicateEmail(email: String) -> AnyPublisher func renewalPassword(req: RenewalPasswordRequestDTO) -> AnyPublisher diff --git a/Projects/Services/DomainModule/Sources/Students/UseCases/SignupUseCase.swift b/Projects/Services/DomainModule/Sources/Students/UseCases/SignupUseCase.swift index 451abbc3..ad6b2643 100644 --- a/Projects/Services/DomainModule/Sources/Students/UseCases/SignupUseCase.swift +++ b/Projects/Services/DomainModule/Sources/Students/UseCases/SignupUseCase.swift @@ -3,5 +3,5 @@ import DataMappingModule import ErrorModule public protocol SignupUseCase { - func execute(req: SignupRequestDTO) -> AnyPublisher + func execute(req: SignupRequestDTO) -> AnyPublisher } diff --git a/Projects/Services/NetworkModule/Sources/Auth/Remote/Stub/RemoteAuthDataSourceStub.swift b/Projects/Services/NetworkModule/Sources/Auth/Remote/Stub/RemoteAuthDataSourceStub.swift index e9538b7b..4ed50357 100644 --- a/Projects/Services/NetworkModule/Sources/Auth/Remote/Stub/RemoteAuthDataSourceStub.swift +++ b/Projects/Services/NetworkModule/Sources/Auth/Remote/Stub/RemoteAuthDataSourceStub.swift @@ -7,9 +7,15 @@ public struct RemoteAuthDataSourceStub: RemoteAuthDataSource { public init() {} public func signin(req: SigninRequestDTO) -> AnyPublisher { - Just(DmsFeatures(studyRoomService: false, remainService: false)) - .setFailureType(to: DmsError.self) - .eraseToAnyPublisher() + Just(DmsFeatures( + mealService: true, + noticeService: true, + pointService: true, + studyRoomService: false, + remainService: false + )) + .setFailureType(to: DmsError.self) + .eraseToAnyPublisher() } public func verifyAuthCode(req: VerifyAuthCodeRequestDTO) -> AnyPublisher { @@ -23,9 +29,15 @@ public struct RemoteAuthDataSourceStub: RemoteAuthDataSource { } public func reissueToken() -> AnyPublisher { - Just(DmsFeatures(studyRoomService: false, remainService: false)) - .setFailureType(to: DmsError.self) - .eraseToAnyPublisher() + Just(DmsFeatures( + mealService: true, + noticeService: true, + pointService: true, + studyRoomService: false, + remainService: false + )) + .setFailureType(to: DmsError.self) + .eraseToAnyPublisher() } public func checkEmailExistByAccountID(req: EmailExistByAccountIDRequestDTO) -> AnyPublisher { diff --git a/Projects/Services/NetworkModule/Sources/Base/DataTransfer/DmsFeaturesDataTransfer.swift b/Projects/Services/NetworkModule/Sources/Base/DataTransfer/DmsFeaturesDataTransfer.swift index 802d1a0c..ed599f78 100644 --- a/Projects/Services/NetworkModule/Sources/Base/DataTransfer/DmsFeaturesDataTransfer.swift +++ b/Projects/Services/NetworkModule/Sources/Base/DataTransfer/DmsFeaturesDataTransfer.swift @@ -4,6 +4,9 @@ import DomainModule public extension DmsFeaturesResponseDTO { func toDomain() -> DmsFeatures { DmsFeatures( + mealService: features.mealService, + noticeService: features.noticeService, + pointService: features.pointService, studyRoomService: features.studyRoomService, remainService: features.remainService ) diff --git a/Projects/Services/NetworkModule/Sources/Students/Remote/Impl/RemoteStudentsDataSourceImpl.swift b/Projects/Services/NetworkModule/Sources/Students/Remote/Impl/RemoteStudentsDataSourceImpl.swift index de89276b..8c13b0f0 100644 --- a/Projects/Services/NetworkModule/Sources/Students/Remote/Impl/RemoteStudentsDataSourceImpl.swift +++ b/Projects/Services/NetworkModule/Sources/Students/Remote/Impl/RemoteStudentsDataSourceImpl.swift @@ -5,8 +5,10 @@ import DomainModule import ErrorModule public final class RemoteStudentsDataSourceImpl: BaseRemoteDataSource, RemoteStudentsDataSource { - public func signup(req: SignupRequestDTO) -> AnyPublisher { - request(.signup(req)) + public func signup(req: SignupRequestDTO) -> AnyPublisher { + request(.signup(req), dto: DmsFeaturesResponseDTO.self) + .map { $0.toDomain() } + .eraseToAnyPublisher() } public func checkDuplicateAccountID(id: String) -> AnyPublisher { diff --git a/Projects/Services/NetworkModule/Sources/Students/Remote/RemoteStudentsDataSource.swift b/Projects/Services/NetworkModule/Sources/Students/Remote/RemoteStudentsDataSource.swift index 2a562c11..6da93c07 100644 --- a/Projects/Services/NetworkModule/Sources/Students/Remote/RemoteStudentsDataSource.swift +++ b/Projects/Services/NetworkModule/Sources/Students/Remote/RemoteStudentsDataSource.swift @@ -4,7 +4,7 @@ import DomainModule import ErrorModule public protocol RemoteStudentsDataSource { - func signup(req: SignupRequestDTO) -> AnyPublisher + func signup(req: SignupRequestDTO) -> AnyPublisher func checkDuplicateAccountID(id: String) -> AnyPublisher func checkDuplicateEmail(email: String) -> AnyPublisher func renewalPassword(req: RenewalPasswordRequestDTO) -> AnyPublisher diff --git a/Projects/Services/NetworkModule/Sources/Students/Remote/Stub/RemoteStudentsDataSourceStub.swift b/Projects/Services/NetworkModule/Sources/Students/Remote/Stub/RemoteStudentsDataSourceStub.swift index aacde1ea..27929e5d 100644 --- a/Projects/Services/NetworkModule/Sources/Students/Remote/Stub/RemoteStudentsDataSourceStub.swift +++ b/Projects/Services/NetworkModule/Sources/Students/Remote/Stub/RemoteStudentsDataSourceStub.swift @@ -7,9 +7,16 @@ import Foundation public struct RemoteStudentsDataSourceStub: RemoteStudentsDataSource { public init() {} - public func signup(req: SignupRequestDTO) -> AnyPublisher { - Just(()).setFailureType(to: DmsError.self) - .eraseToAnyPublisher() + public func signup(req: SignupRequestDTO) -> AnyPublisher { + Just(DmsFeatures( + mealService: true, + noticeService: true, + pointService: true, + studyRoomService: false, + remainService: false + )) + .setFailureType(to: DmsError.self) + .eraseToAnyPublisher() } public func checkDuplicateAccountID(id: String) -> AnyPublisher { diff --git a/Projects/Services/NetworkModule/Tests/Auth/Remote/RemoteAuthDataSourceImplSpec.swift b/Projects/Services/NetworkModule/Tests/Auth/Remote/RemoteAuthDataSourceImplSpec.swift index 34124f3b..aecee671 100644 --- a/Projects/Services/NetworkModule/Tests/Auth/Remote/RemoteAuthDataSourceImplSpec.swift +++ b/Projects/Services/NetworkModule/Tests/Auth/Remote/RemoteAuthDataSourceImplSpec.swift @@ -32,21 +32,6 @@ final class RemoteAuthDataSourceImplSpec: QuickSpec { provider: provider) } describe("RemoteAuthDataSourceImpl에서") { - context("signin()을 실행하면") { - it("request를 성공적으로 실행한다.") { - var success: Void? - var res: DmsFeatures? - sut.signin(req: .init(accountID: "", password: "")) - .sink { _ in } receiveValue: { item in - success = () - res = item - } - .store(in: &bag) - expect { success }.toNotEventually(beNil()) - expect { success }.toEventually(beVoid()) - expect { res }.toNot(beNil()) - } - } context("verifyAuthCode()를 실행하면") { it("request를 성공적으로 실행한다.") { var success: Void? diff --git a/Projects/Services/NetworkModule/Tests/Students/Remote/RemoteStudentsDataSourceImplSpec.swift b/Projects/Services/NetworkModule/Tests/Students/Remote/RemoteStudentsDataSourceImplSpec.swift index 7c0b73ef..7f4e0658 100644 --- a/Projects/Services/NetworkModule/Tests/Students/Remote/RemoteStudentsDataSourceImplSpec.swift +++ b/Projects/Services/NetworkModule/Tests/Students/Remote/RemoteStudentsDataSourceImplSpec.swift @@ -39,31 +39,6 @@ final class RemoteStudentsDataSourceImplSpec: QuickSpec { ) } describe("RemoteStudentsDataSourceImpl에서") { - context("Signup()을 실행하면 ") { - it("request를 성공적으로 실행한다.") { - var success: Void? - sut.signup( - req: SignupRequestDTO( - schoolCode: "", - schoolAnswer: "", - email: "", - authCode: "", - grade: 0, - classRoom: 0, - number: 0, - accountID: "", - password: "", - profileImageUrl: nil - ) - ) - .sink { _ in } receiveValue: { item in - success = item - } - .store(in: &bag) - expect { success }.toNotEventually(beNil()) - expect { success }.toEventually(beVoid()) - } - } context("checkDuplicateAccountID()을 실행하면 ") { it("request를 성공적으로 실행한다.") { var success: Void? @@ -142,7 +117,7 @@ final class RemoteStudentsDataSourceImplSpec: QuickSpec { keychain.save(type: .accessExpiredAt, value: Date().addingTimeInterval(500).toDMSDateString()) } afterEach { - keychain.delete(type: .expiredAt) + keychain.delete(type: .accessExpiredAt) } it("request를 성공적으로 실행하고, sampleData가 Response로 온다.") { var success: Void?