@@ -30,6 +30,63 @@ struct FirebaseSwiftUIExampleTests {
3030 return " \( before) @ \( after) .com "
3131 }
3232
33+ @Test
34+ @MainActor
35+ func testDefaultAuthConfigurationInjection( ) async throws {
36+ let config = AuthConfiguration ( )
37+ let service = AuthService ( configuration: config)
38+
39+ let actual = service. configuration
40+
41+ #expect( actual. shouldHideCancelButton == false )
42+ #expect( actual. interactiveDismissEnabled == true )
43+ #expect( actual. shouldAutoUpgradeAnonymousUsers == false )
44+ #expect( actual. customStringsBundle == nil )
45+ #expect( actual. tosUrl == nil )
46+ #expect( actual. privacyPolicyUrl == nil )
47+ #expect( actual. emailLinkSignInActionCodeSettings == nil )
48+ #expect( actual. verifyEmailActionCodeSettings == nil )
49+ }
50+
51+ @Test
52+ @MainActor
53+ func testCustomAuthConfigurationInjection( ) async throws {
54+ let emailSettings = ActionCodeSettings ( )
55+ emailSettings. handleCodeInApp = true
56+ emailSettings. url = URL ( string: " https://example.com/email-link " )
57+ emailSettings. setIOSBundleID ( " com.example.test " )
58+
59+ let verifySettings = ActionCodeSettings ( )
60+ verifySettings. handleCodeInApp = true
61+ verifySettings. url = URL ( string: " https://example.com/verify-email " )
62+ verifySettings. setIOSBundleID ( " com.example.test " )
63+
64+ let config = AuthConfiguration (
65+ shouldHideCancelButton: true ,
66+ interactiveDismissEnabled: false ,
67+ shouldAutoUpgradeAnonymousUsers: true ,
68+ customStringsBundle: . main,
69+ tosUrl: URL ( string: " https://example.com/tos " ) ,
70+ privacyPolicyUrl: URL ( string: " https://example.com/privacy " ) ,
71+ emailLinkSignInActionCodeSettings: emailSettings,
72+ verifyEmailActionCodeSettings: verifySettings
73+ )
74+
75+ let service = AuthService ( configuration: config)
76+
77+ let actual = service. configuration
78+ #expect( actual. shouldHideCancelButton == true )
79+ #expect( actual. interactiveDismissEnabled == false )
80+ #expect( actual. shouldAutoUpgradeAnonymousUsers == true )
81+ #expect( actual. customStringsBundle === Bundle . main)
82+ #expect( actual. tosUrl == URL ( string: " https://example.com/tos " ) )
83+ #expect( actual. privacyPolicyUrl == URL ( string: " https://example.com/privacy " ) )
84+
85+ // Optional action code settings checks
86+ #expect( actual. emailLinkSignInActionCodeSettings? . url == emailSettings. url)
87+ #expect( actual. verifyEmailActionCodeSettings? . url == verifySettings. url)
88+ }
89+
3390 @Test
3491 @MainActor
3592 func testCreateEmailPasswordUser( ) async throws {
@@ -41,7 +98,7 @@ struct FirebaseSwiftUIExampleTests {
4198 #expect( service. signedInCredential == nil )
4299 #expect( service. currentUser == nil )
43100 try await service. createUser ( withEmail: createEmail ( ) , password: kPassword)
44-
101+ try await Task . sleep ( nanoseconds : 2_000_000_000 )
45102 #expect( service. authenticationState == . authenticated)
46103 #expect( service. authView == . authPicker)
47104 #expect( service. errorMessage. isEmpty)
@@ -57,7 +114,7 @@ struct FirebaseSwiftUIExampleTests {
57114 let email = createEmail ( )
58115 try await service. createUser ( withEmail: email, password: kPassword)
59116 try await service. signOut ( )
60- try await Task . sleep ( nanoseconds: 1_000_000_000 )
117+ try await Task . sleep ( nanoseconds: 2_000_000_000 )
61118 #expect( service. authenticationState == . unauthenticated)
62119 #expect( service. authView == . authPicker)
63120 #expect( service. errorMessage. isEmpty)
0 commit comments