From bed90e93ce26ef4885691b3b92b22efb68eed3e8 Mon Sep 17 00:00:00 2001 From: opficdev <162981733+opficdev@users.noreply.github.com> Date: Mon, 6 Jul 2026 18:25:27 +0900 Subject: [PATCH 1/5] =?UTF-8?q?refactor:=20NotificationTab=EC=9D=98=20targ?= =?UTF-8?q?et-local=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PushNotificationListTestSpies.swift | 52 ++++++++++++++ .../Tests/Support/TestSupport.swift | 68 ------------------- 2 files changed, 52 insertions(+), 68 deletions(-) create mode 100644 Application/Presentation/NotificationTab/Tests/PushNotification/PushNotificationListTestSpies.swift diff --git a/Application/Presentation/NotificationTab/Tests/PushNotification/PushNotificationListTestSpies.swift b/Application/Presentation/NotificationTab/Tests/PushNotification/PushNotificationListTestSpies.swift new file mode 100644 index 00000000..40ad683b --- /dev/null +++ b/Application/Presentation/NotificationTab/Tests/PushNotification/PushNotificationListTestSpies.swift @@ -0,0 +1,52 @@ +// +// PushNotificationListTestSpies.swift +// NotificationTabTests +// +// Created by opfic on 7/6/26. +// + +import Domain + +final class DeletePushNotificationUseCaseSpy: DeletePushNotificationUseCase { + private(set) var calledNotificationIds = [String]() + + func execute(_ notificationID: String) async throws { + calledNotificationIds.append(notificationID) + } +} + +final class UndoDeletePushNotificationUseCaseSpy: UndoDeletePushNotificationUseCase { + private(set) var calledNotificationIds = [String]() + + func execute(_ notificationID: String) async throws { + calledNotificationIds.append(notificationID) + } +} + +final class TogglePushNotificationReadUseCaseSpy: TogglePushNotificationReadUseCase { + private(set) var calledTodoIds = [String]() + var error: Error? + + func execute(_ todoId: String) async throws { + calledTodoIds.append(todoId) + if let error { + throw error + } + } +} + +final class FetchPushNotificationQueryUseCaseSpy: FetchPushNotificationQueryUseCase { + var pushNotificationQuery = PushNotificationQuery.default + + func execute() -> PushNotificationQuery { + pushNotificationQuery + } +} + +final class UpdatePushNotificationQueryUseCaseSpy: UpdatePushNotificationQueryUseCase { + private(set) var queries = [PushNotificationQuery]() + + func execute(_ query: PushNotificationQuery) { + queries.append(query) + } +} diff --git a/Application/Presentation/PresentationShared/Tests/Support/TestSupport.swift b/Application/Presentation/PresentationShared/Tests/Support/TestSupport.swift index 64c56022..e775f919 100644 --- a/Application/Presentation/PresentationShared/Tests/Support/TestSupport.swift +++ b/Application/Presentation/PresentationShared/Tests/Support/TestSupport.swift @@ -26,30 +26,6 @@ func waitUntil( } } -final class FetchPushNotificationsUseCaseSpy: FetchPushNotificationsUseCase { - var pushNotificationPage: PushNotificationPage - private(set) var executeCallCount = 0 - - init(pushNotificationPage: PushNotificationPage) { - self.pushNotificationPage = pushNotificationPage - } - - func execute( - _ query: PushNotificationQuery, - cursor: PushNotificationCursor? - ) async throws -> PushNotificationPage { - executeCallCount += 1 - return pushNotificationPage - } - - func observe( - _ query: PushNotificationQuery, - limit: Int - ) throws -> AnyPublisher { - Empty().eraseToAnyPublisher() - } -} - final class SignInUseCaseSpy: SignInUseCase { var error: Error? var signedIn = true @@ -94,50 +70,6 @@ final class SignInUseCaseSpy: SignInUseCase { } } -final class DeletePushNotificationUseCaseSpy: DeletePushNotificationUseCase { - private(set) var calledNotificationIds: [String] = [] - - func execute(_ notificationID: String) async throws { - calledNotificationIds.append(notificationID) - } -} - -final class UndoDeletePushNotificationUseCaseSpy: UndoDeletePushNotificationUseCase { - private(set) var calledNotificationIds: [String] = [] - - func execute(_ notificationID: String) async throws { - calledNotificationIds.append(notificationID) - } -} - -final class TogglePushNotificationReadUseCaseSpy: TogglePushNotificationReadUseCase { - private(set) var calledTodoIds: [String] = [] - var error: Error? - - func execute(_ todoId: String) async throws { - calledTodoIds.append(todoId) - if let error { - throw error - } - } -} - -final class FetchPushNotificationQueryUseCaseSpy: FetchPushNotificationQueryUseCase { - var pushNotificationQuery = PushNotificationQuery.default - - func execute() -> PushNotificationQuery { - pushNotificationQuery - } -} - -final class UpdatePushNotificationQueryUseCaseSpy: UpdatePushNotificationQueryUseCase { - private(set) var queries: [PushNotificationQuery] = [] - - func execute(_ query: PushNotificationQuery) { - queries.append(query) - } -} - final class FetchTodoCategoryPreferencesUseCaseSpy: FetchTodoCategoryPreferencesUseCase { var todoCategoryPreferences: [TodoCategoryPreference] = [] From f78437e7b9503b6f526486965e4240b21925a0d1 Mon Sep 17 00:00:00 2001 From: opficdev <162981733+opficdev@users.noreply.github.com> Date: Mon, 6 Jul 2026 18:29:23 +0900 Subject: [PATCH 2/5] =?UTF-8?q?chore:=20Entry=20=ED=85=8C=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=20support=20=EC=A4=91=EB=B3=B5=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Tests/Support/TestSupport.swift | 44 ------------------- 1 file changed, 44 deletions(-) diff --git a/Application/Presentation/PresentationShared/Tests/Support/TestSupport.swift b/Application/Presentation/PresentationShared/Tests/Support/TestSupport.swift index e775f919..8b8ebd0a 100644 --- a/Application/Presentation/PresentationShared/Tests/Support/TestSupport.swift +++ b/Application/Presentation/PresentationShared/Tests/Support/TestSupport.swift @@ -26,50 +26,6 @@ func waitUntil( } } -final class SignInUseCaseSpy: SignInUseCase { - var error: Error? - var signedIn = true - var shouldSuspend = false - private(set) var calledProviders: [AuthProvider] = [] - private(set) var successfulProviders = [AuthProvider]() - private var continuation: CheckedContinuation? - private var shouldResume = false - - func execute(_ provider: AuthProvider) async throws -> Bool { - calledProviders.append(provider) - - if shouldSuspend { - await withCheckedContinuation { continuation in - if shouldResume { - shouldResume = false - continuation.resume() - } else { - self.continuation = continuation - } - } - } - - if let error { - throw error - } - - if signedIn { - successfulProviders.append(provider) - } - - return signedIn - } - - func resume() { - guard let continuation else { - shouldResume = true - return - } - self.continuation = nil - continuation.resume() - } -} - final class FetchTodoCategoryPreferencesUseCaseSpy: FetchTodoCategoryPreferencesUseCase { var todoCategoryPreferences: [TodoCategoryPreference] = [] From 35f05349a43d9c673fd97448ab20907c5bc1a079 Mon Sep 17 00:00:00 2001 From: opficdev <162981733+opficdev@users.noreply.github.com> Date: Mon, 6 Jul 2026 18:35:10 +0900 Subject: [PATCH 3/5] =?UTF-8?q?refactor:=20HomeTab=20=ED=85=8C=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=20support=20=EC=A4=91=EB=B3=B5=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Tests/Support/TestSupport.swift | 77 ------------------- 1 file changed, 77 deletions(-) diff --git a/Application/Presentation/PresentationShared/Tests/Support/TestSupport.swift b/Application/Presentation/PresentationShared/Tests/Support/TestSupport.swift index 8b8ebd0a..df6443c4 100644 --- a/Application/Presentation/PresentationShared/Tests/Support/TestSupport.swift +++ b/Application/Presentation/PresentationShared/Tests/Support/TestSupport.swift @@ -7,7 +7,6 @@ import Testing import Foundation -import Combine import Core import Domain @testable import PresentationShared @@ -26,50 +25,6 @@ func waitUntil( } } -final class FetchTodoCategoryPreferencesUseCaseSpy: FetchTodoCategoryPreferencesUseCase { - var todoCategoryPreferences: [TodoCategoryPreference] = [] - - func execute() async throws -> [TodoCategoryPreference] { - todoCategoryPreferences - } -} - -final class UpdateTodoCategoryPreferencesUseCaseSpy: UpdateTodoCategoryPreferencesUseCase { - private(set) var updates: [[TodoCategoryPreference]] = [] - - func execute(_ preferences: [TodoCategoryPreference]) async throws { - updates.append(preferences) - } -} - -final class AddWebPageUseCaseSpy: AddWebPageUseCase { - var error: Error? - private(set) var calledUrlStrings: [String] = [] - - func execute(_ urlString: String) async throws { - calledUrlStrings.append(urlString) - if let error { - throw error - } - } -} - -final class DeleteWebPageUseCaseSpy: DeleteWebPageUseCase { - private(set) var calls: [(id: String, urlString: String)] = [] - - func execute(id: String, urlString: String) async throws { - calls.append((id, urlString)) - } -} - -final class UndoDeleteWebPageUseCaseSpy: UndoDeleteWebPageUseCase { - private(set) var calledIDs: [String] = [] - - func execute(_ id: String) async throws { - calledIDs.append(id) - } -} - final class UpsertTodoUseCaseSpy: UpsertTodoUseCase { private(set) var todos: [Todo] = [] private(set) var todoDrafts: [TodoDraft] = [] @@ -83,16 +38,6 @@ final class UpsertTodoUseCaseSpy: UpsertTodoUseCase { } } -final class FetchTodosUseCaseSpy: FetchTodosUseCase { - var todoPage = TodoPage(items: [], nextCursor: nil) - private(set) var queries: [TodoQuery] = [] - - func execute(_ query: TodoQuery, cursor: TodoCursor?) async throws -> TodoPage { - queries.append(query) - return todoPage - } -} - final class FetchUserDataUseCaseSpy: FetchUserDataUseCase { var profile: UserProfile @@ -142,25 +87,3 @@ final class UpdateHeatmapActivityTypesUseCaseSpy: UpdateHeatmapActivityTypesUseC self.activityTypes.append(activityTypes) } } - -final class FetchWebPagesUseCaseSpy: FetchWebPagesUseCase { - var webPages: [WebPage] - private(set) var calledQueries: [String] = [] - - init(webPages: [WebPage]) { - self.webPages = webPages - } - - func execute(_ query: String) async throws -> [WebPage] { - calledQueries.append(query) - return webPages - } -} - -final class ObserveNetworkConnectivityUseCaseSpy: ObserveNetworkConnectivityUseCase { - let currentValueSubject = CurrentValueSubject(true) - - func observe() -> AnyPublisher { - currentValueSubject.eraseToAnyPublisher() - } -} From 9e964791426bce3425c998fb0d4cef1006cfd85c Mon Sep 17 00:00:00 2001 From: opficdev <162981733+opficdev@users.noreply.github.com> Date: Mon, 6 Jul 2026 18:40:52 +0900 Subject: [PATCH 4/5] =?UTF-8?q?refactor:=20ProfileTab=20=ED=85=8C=EC=8A=A4?= =?UTF-8?q?=ED=8A=B8=20support=20=EC=A4=91=EB=B3=B5=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Tests/Support/TestSupport.swift | 50 ------------------- 1 file changed, 50 deletions(-) diff --git a/Application/Presentation/PresentationShared/Tests/Support/TestSupport.swift b/Application/Presentation/PresentationShared/Tests/Support/TestSupport.swift index df6443c4..6d1297eb 100644 --- a/Application/Presentation/PresentationShared/Tests/Support/TestSupport.swift +++ b/Application/Presentation/PresentationShared/Tests/Support/TestSupport.swift @@ -37,53 +37,3 @@ final class UpsertTodoUseCaseSpy: UpsertTodoUseCase { todoDrafts.append(todoDraft) } } - -final class FetchUserDataUseCaseSpy: FetchUserDataUseCase { - var profile: UserProfile - - init(profile: UserProfile) { - self.profile = profile - } - - func execute() async throws -> UserProfile { - profile - } -} - -final class FetchProfileImageDataUseCaseSpy: FetchProfileImageDataUseCase { - var data: Data - private(set) var calledURLs: [URL] = [] - - init(data: Data) { - self.data = data - } - - func execute(from url: URL) async throws -> Data { - calledURLs.append(url) - return data - } -} - -final class UpsertStatusMessageUseCaseSpy: UpsertStatusMessageUseCase { - private(set) var messages: [String] = [] - - func execute(_ message: String) async throws { - messages.append(message) - } -} - -final class FetchHeatmapActivityTypesUseCaseSpy: FetchHeatmapActivityTypesUseCase { - var activityTypes: [String] = [] - - func execute() -> [String] { - activityTypes - } -} - -final class UpdateHeatmapActivityTypesUseCaseSpy: UpdateHeatmapActivityTypesUseCase { - private(set) var activityTypes: [[String]] = [] - - func execute(_ activityTypes: [String]) { - self.activityTypes.append(activityTypes) - } -} From 1b4462c31e825a24db17afe25ef3dc1404839c3c Mon Sep 17 00:00:00 2001 From: opficdev <162981733+opficdev@users.noreply.github.com> Date: Mon, 6 Jul 2026 18:43:24 +0900 Subject: [PATCH 5/5] =?UTF-8?q?refactor:=20PresentationShared=20=ED=85=8C?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=20support=20=EB=B2=94=EC=9C=84=20=EC=B6=95?= =?UTF-8?q?=EC=86=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Tests/Support/TestSupport.swift | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/Application/Presentation/PresentationShared/Tests/Support/TestSupport.swift b/Application/Presentation/PresentationShared/Tests/Support/TestSupport.swift index 6d1297eb..71530f20 100644 --- a/Application/Presentation/PresentationShared/Tests/Support/TestSupport.swift +++ b/Application/Presentation/PresentationShared/Tests/Support/TestSupport.swift @@ -7,9 +7,6 @@ import Testing import Foundation -import Core -import Domain -@testable import PresentationShared @MainActor func waitUntil( @@ -24,16 +21,3 @@ func waitUntil( try? await Task.sleep(for: pollInterval) } } - -final class UpsertTodoUseCaseSpy: UpsertTodoUseCase { - private(set) var todos: [Todo] = [] - private(set) var todoDrafts: [TodoDraft] = [] - - func execute(_ todo: Todo) async throws { - todos.append(todo) - } - - func execute(_ todoDraft: TodoDraft) async throws { - todoDrafts.append(todoDraft) - } -}