@@ -30,6 +30,63 @@ struct FirebaseSwiftUIExampleTests {
30
30
return " \( before) @ \( after) .com "
31
31
}
32
32
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
+
33
90
@Test
34
91
@MainActor
35
92
func testCreateEmailPasswordUser( ) async throws {
@@ -41,7 +98,7 @@ struct FirebaseSwiftUIExampleTests {
41
98
#expect( service. signedInCredential == nil )
42
99
#expect( service. currentUser == nil )
43
100
try await service. createUser ( withEmail: createEmail ( ) , password: kPassword)
44
-
101
+ try await Task . sleep ( nanoseconds : 2_000_000_000 )
45
102
#expect( service. authenticationState == . authenticated)
46
103
#expect( service. authView == . authPicker)
47
104
#expect( service. errorMessage. isEmpty)
@@ -57,7 +114,7 @@ struct FirebaseSwiftUIExampleTests {
57
114
let email = createEmail ( )
58
115
try await service. createUser ( withEmail: email, password: kPassword)
59
116
try await service. signOut ( )
60
- try await Task . sleep ( nanoseconds: 1_000_000_000 )
117
+ try await Task . sleep ( nanoseconds: 2_000_000_000 )
61
118
#expect( service. authenticationState == . unauthenticated)
62
119
#expect( service. authView == . authPicker)
63
120
#expect( service. errorMessage. isEmpty)
0 commit comments