Skip to content

Commit 9f4155d

Browse files
committed
test: 소셜 인증 취소 흐름 테스트 갱신
1 parent 75cfb8c commit 9f4155d

3 files changed

Lines changed: 17 additions & 9 deletions

File tree

Application/DevLogPresentation/Tests/Login/LoginFeatureTests.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,10 @@ struct LoginFeatureTests {
110110
))
111111
}
112112

113-
@Test("소셜 로그인 취소 에러가 발생하면 알림을 표시하지 않는다")
114-
func 소셜_로그인_취소_에러가_발생하면_알림을_표시하지_않는다() async {
113+
@Test("소셜 로그인이 취소되어도 알림을 표시하지 않는다")
114+
func 소셜_로그인이_취소되어도_알림을_표시하지_않는다() async {
115115
let spy = SignInUseCaseSpy()
116-
spy.error = NSError(domain: "com.google.GIDSignIn", code: -5)
116+
spy.signedIn = false
117117
let driver = LoginTestDriver(useCase: spy)
118118

119119
driver.tapSignInButton(.google)

Application/DevLogPresentation/Tests/Settings/AccountFeatureTests.swift

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,10 @@ struct AccountFeatureTests {
181181
}
182182
}
183183

184-
@Test("소셜 로그인 취소 에러로 연동이 실패하면 알림을 표시하지 않는다")
185-
func 소셜_로그인_취소_에러로_연동이_실패하면_알림을_표시하지_않는다() async {
184+
@Test("소셜 로그인이 취소되어도 연동 알림을 표시하지 않는다")
185+
func 소셜_로그인이_취소되어도_연동_알림을_표시하지_않는다() async {
186186
let linkSpy = LinkAuthProviderUseCaseSpy()
187-
linkSpy.error = NSError(domain: "com.google.GIDSignIn", code: -5)
187+
linkSpy.linked = false
188188
let driver = AccountTestDriver(linkUseCase: linkSpy)
189189

190190
driver.linkWithProvider(.google)
@@ -323,12 +323,13 @@ private final class FetchAuthProvidersUseCaseSpy: FetchAuthProvidersUseCase {
323323

324324
private final class LinkAuthProviderUseCaseSpy: LinkAuthProviderUseCase {
325325
var error: Error?
326+
var linked = true
326327
var shouldSuspend = false
327328
private(set) var providers = [AuthProvider]()
328329
private var continuation: CheckedContinuation<Void, Never>?
329330
private var shouldResume = false
330331

331-
func execute(_ provider: AuthProvider) async throws {
332+
func execute(_ provider: AuthProvider) async throws -> Bool {
332333
providers.append(provider)
333334

334335
if shouldSuspend {
@@ -345,6 +346,8 @@ private final class LinkAuthProviderUseCaseSpy: LinkAuthProviderUseCase {
345346
if let error {
346347
throw error
347348
}
349+
350+
return linked
348351
}
349352

350353
func resume() {

Application/DevLogPresentation/Tests/Support/TestSupport.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,14 @@ final class FetchPushNotificationsUseCaseSpy: FetchPushNotificationsUseCase {
5252

5353
final class SignInUseCaseSpy: SignInUseCase {
5454
var error: Error?
55+
var signedIn = true
5556
var shouldSuspend = false
5657
private(set) var calledProviders: [AuthProvider] = []
5758
private(set) var successfulProviders = [AuthProvider]()
5859
private var continuation: CheckedContinuation<Void, Never>?
5960
private var shouldResume = false
6061

61-
func execute(_ provider: AuthProvider) async throws {
62+
func execute(_ provider: AuthProvider) async throws -> Bool {
6263
calledProviders.append(provider)
6364

6465
if shouldSuspend {
@@ -76,7 +77,11 @@ final class SignInUseCaseSpy: SignInUseCase {
7677
throw error
7778
}
7879

79-
successfulProviders.append(provider)
80+
if signedIn {
81+
successfulProviders.append(provider)
82+
}
83+
84+
return signedIn
8085
}
8186

8287
func resume() {

0 commit comments

Comments
 (0)