diff --git a/iOS/Layover/Layover.xcodeproj/project.pbxproj b/iOS/Layover/Layover.xcodeproj/project.pbxproj index 15c92eb..6baf284 100644 --- a/iOS/Layover/Layover.xcodeproj/project.pbxproj +++ b/iOS/Layover/Layover.xcodeproj/project.pbxproj @@ -108,7 +108,6 @@ 19AE48182B28C2B700DD4612 /* SettingInteractorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19AE48142B28C2B700DD4612 /* SettingInteractorTests.swift */; }; 19AE481A2B28C2B700DD4612 /* SettingPresenterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19AE48162B28C2B700DD4612 /* SettingPresenterTests.swift */; }; 19AE481C2B28C53800DD4612 /* MockSettingWorker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19AE481B2B28C53800DD4612 /* MockSettingWorker.swift */; }; - 19AE48222B29D03D00DD4612 /* EditProfileViewControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19AE481E2B29D03D00DD4612 /* EditProfileViewControllerTests.swift */; }; 19AE48232B29D03D00DD4612 /* EditProfileInteractorTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19AE481F2B29D03D00DD4612 /* EditProfileInteractorTests.swift */; }; 19AE48252B29D03D00DD4612 /* EditProfilePresenterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19AE48212B29D03D00DD4612 /* EditProfilePresenterTests.swift */; }; 19C7AFCE2B02410F003B35F2 /* AuthManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19C7AFCD2B02410F003B35F2 /* AuthManager.swift */; }; @@ -351,7 +350,6 @@ 19AE48142B28C2B700DD4612 /* SettingInteractorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingInteractorTests.swift; sourceTree = ""; }; 19AE48162B28C2B700DD4612 /* SettingPresenterTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingPresenterTests.swift; sourceTree = ""; }; 19AE481B2B28C53800DD4612 /* MockSettingWorker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockSettingWorker.swift; sourceTree = ""; }; - 19AE481E2B29D03D00DD4612 /* EditProfileViewControllerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditProfileViewControllerTests.swift; sourceTree = ""; }; 19AE481F2B29D03D00DD4612 /* EditProfileInteractorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditProfileInteractorTests.swift; sourceTree = ""; }; 19AE48212B29D03D00DD4612 /* EditProfilePresenterTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditProfilePresenterTests.swift; sourceTree = ""; }; 19C7AFCD2B02410F003B35F2 /* AuthManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthManager.swift; sourceTree = ""; }; @@ -750,7 +748,6 @@ 19AE481D2B29D02700DD4612 /* EditProfile */ = { isa = PBXGroup; children = ( - 19AE481E2B29D03D00DD4612 /* EditProfileViewControllerTests.swift */, 19AE481F2B29D03D00DD4612 /* EditProfileInteractorTests.swift */, 19AE48212B29D03D00DD4612 /* EditProfilePresenterTests.swift */, ); @@ -1523,7 +1520,6 @@ 19AE48172B28C2B700DD4612 /* SettingViewControllerTests.swift in Sources */, 194C21C32B1DEE6B00C62645 /* HomeViewControllerTests.swift in Sources */, 192513692B26F7CE001533FA /* TagPlayListInteractorTests.swift in Sources */, - 19AE48222B29D03D00DD4612 /* EditProfileViewControllerTests.swift in Sources */, 19AE48232B29D03D00DD4612 /* EditProfileInteractorTests.swift in Sources */, 194C21CC2B1DF39200C62645 /* MockHomeWorker.swift in Sources */, ); diff --git a/iOS/Layover/LayoverTests/Scenes/EditProfile/EditProfileInteractorTests.swift b/iOS/Layover/LayoverTests/Scenes/EditProfile/EditProfileInteractorTests.swift index ad65887..f409a9f 100644 --- a/iOS/Layover/LayoverTests/Scenes/EditProfile/EditProfileInteractorTests.swift +++ b/iOS/Layover/LayoverTests/Scenes/EditProfile/EditProfileInteractorTests.swift @@ -76,6 +76,12 @@ final class EditProfileInteractorTests: XCTestCase { } } + final class UserWorkerMock: UserWorker { + override func checkNotDuplication(for userName: String) async -> Bool? { + return false + } + } + // MARK: - Tests func test_setProfile을_실행하면_presenter의_presentProfile이_호출되고_자신의_데이터를_presenter에게_전달한다() { @@ -281,7 +287,6 @@ final class EditProfileInteractorTests: XCTestCase { } func test_checkDuplication을_실행했을때_중복된_닉네임이_아니라면_presenter의_presentNicknameDuplication을_호출하고_올바른_값을_전달한다() async { - // arrange let spy = EditProfilePresentationLogicSpy() sut.presenter = spy @@ -298,5 +303,23 @@ final class EditProfileInteractorTests: XCTestCase { "checkDuplication을 호출해서 presenter에게 올바른 canEditProfile값을 전달하지 못했다.") } + func test_checkDuplication을_실행했을때_중복된_닉네임이라면_presenter의_presentNicknameDuplication을_호출하고_올바른_값을_전달한다() async { + + // arrange + let spy = EditProfilePresentationLogicSpy() + sut.presenter = spy + sut.userWorker = UserWorkerMock() + + // act + await sut.checkDuplication(with: Models.CheckNicknameDuplication.Request(nickname: "안유진")) + + // assert + XCTAssertTrue(spy.presentNicknameDuplicationCalled, "checkDuplication을 호출해서 presenter의 presentNicknameDuplication을 호출하지 못했다.") + XCTAssertFalse(spy.presentNicknameDuplicationResponse.isValid, + "checkDuplication을 호출해서 presenter에게 올바른 isValid값을 전달하지 못했다.") + + XCTAssertFalse(spy.presentNicknameDuplicationResponse.canEditProfile, + "checkDuplication을 호출해서 presenter에게 올바른 canEditProfile값을 전달하지 못했다.")} + // TODO: editProfile 테스트 메서드는 내부 병렬실행 이슈 해결 후 작성 } diff --git a/iOS/Layover/LayoverTests/Scenes/EditProfile/EditProfileViewControllerTests.swift b/iOS/Layover/LayoverTests/Scenes/EditProfile/EditProfileViewControllerTests.swift deleted file mode 100644 index 5e3d3b4..0000000 --- a/iOS/Layover/LayoverTests/Scenes/EditProfile/EditProfileViewControllerTests.swift +++ /dev/null @@ -1,84 +0,0 @@ -//// -//// EditProfileViewControllerTests.swift -//// Layover -//// -//// Created by 김인환 on 12/13/23. -//// Copyright (c) 2023 CodeBomber. All rights reserved. -//// -//// This file was generated by the Clean Swift Xcode Templates so -//// you can apply clean architecture to your iOS and Mac projects, -//// see http://clean-swift.com -//// -// -//@testable import Layover -//import XCTest -// -//class EditProfileViewControllerTests: XCTestCase { -// // MARK: Subject under test -// -// var sut: EditProfileViewController! -// var window: UIWindow! -// -// // MARK: - Test lifecycle -// -// override func setUp() { -// super.setUp() -// window = UIWindow() -// setupEditProfileViewController() -// } -// -// override func tearDown() { -// window = nil -// super.tearDown() -// } -// -// // MARK: - Test setup -// -// func setupEditProfileViewController() { -// let bundle = Bundle.main -// let storyboard = UIStoryboard(name: "Main", bundle: bundle) -// sut = storyboard.instantiateViewController(withIdentifier: "EditProfileViewController") as! EditProfileViewController -// } -// -// func loadView() { -// window.addSubview(sut.view) -// RunLoop.current.run(until: Date()) -// } -// -// // MARK: - Test doubles -// -// class EditProfileBusinessLogicSpy: EditProfileBusinessLogic { -// var doSomethingCalled = false -// -// func doSomething(request: EditProfile.Something.Request) -// { -// doSomethingCalled = true -// } -// } -// -// // MARK: - Tests -// -// func testShouldDoSomethingWhenViewIsLoaded() { -// // Given -// let spy = EditProfileBusinessLogicSpy() -// sut.interactor = spy -// -// // When -// loadView() -// -// // Then -// XCTAssertTrue(spy.doSomethingCalled, "viewDidLoad() should ask the interactor to do something") -// } -// -// func testDisplaySomething() { -// // Given -// let viewModel = EditProfile.Something.ViewModel() -// -// // When -// loadView() -// sut.displaySomething(viewModel: viewModel) -// -// // Then -// //XCTAssertEqual(sut.nameTextField.text, "", "displaySomething(viewModel:) should update the name text field") -// } -//}