@@ -19,8 +19,7 @@ import com.google.common.truth.Truth.assertThat
19
19
import com.google.firebase.FirebaseApp
20
20
import com.google.firebase.FirebaseOptions
21
21
import com.google.firebase.functions.FirebaseFunctions
22
- import com.google.firebase.functions.HttpsCallableReference
23
- import com.google.firebase.functions.TestVisibilityUtil
22
+ import com.google.firebase.functions.usesLimitedUseFacTokens
24
23
import com.google.firebase.ktx.Firebase
25
24
import com.google.firebase.ktx.app
26
25
import com.google.firebase.ktx.initialize
@@ -107,35 +106,47 @@ class LibraryVersionTest : BaseTestCase() {
107
106
108
107
@RunWith(RobolectricTestRunner ::class )
109
108
class AppCheckLimitedUseTest : BaseTestCase () {
109
+ @Test
110
+ fun `FirebaseFunctions#getHttpsCallable should not use limited-use tokens by default` () {
111
+ val callable = Firebase .functions.getHttpsCallable(" function" )
112
+ assertThat(callable.usesLimitedUseFacTokens()).isFalse()
113
+ }
114
+
110
115
@Test
111
116
fun `FirebaseFunctions#getHttpsCallable should build callable with FAC settings (when true)` () {
112
117
val callable = Firebase .functions.getHttpsCallable(" function" ) {
113
118
limitedUseAppCheckTokens = true
114
- };
115
- assertThat(TestVisibilityUtil .refUsesLimitedUseFacTokens(callable )).isEqualTo( true )
119
+ }
120
+ assertThat(callable.usesLimitedUseFacTokens( )).isTrue( )
116
121
}
117
122
118
- // @Test
119
- // fun `FirebaseFunctions#getHttpsCallable should build callable with FAC settings (when false)`() {
120
- // val callable = Firebase.functions.getHttpsCallable("function") {
121
- // limitedUseAppCheckTokens = false
122
- // };
123
- // assertLimitedUseFACTokens(callable, false)
124
- // }
125
- //
126
- // @Test
127
- // fun `FirebaseFunctions#getHttpsCallableFromUrl callable with FAC settings (when true)`() {
128
- // val callable = Firebase.functions.getHttpsCallableFromUrl(URL()) {
129
- // limitedUseAppCheckTokens = true
130
- // };
131
- // assertLimitedUseFACTokens(callable, true)
132
- // }
133
- //
134
- // @Test
135
- // fun `FirebaseFunctions#getHttpsCallable should build callable with FAC settings (when false)`() {
136
- // val callable = Firebase.functions.getHttpsCallable("function") {
137
- // limitedUseAppCheckTokens = false
138
- // };
139
- // assertLimitedUseFACTokens(callable, false)
140
- // }
123
+ @Test
124
+ fun `FirebaseFunctions#getHttpsCallable should build callable with FAC settings (when false)` () {
125
+ val callable = Firebase .functions.getHttpsCallable(" function" ) {
126
+ limitedUseAppCheckTokens = false
127
+ }
128
+ assertThat(callable.usesLimitedUseFacTokens()).isFalse()
129
+ }
130
+
131
+ @Test
132
+ fun `FirebaseFunctions#getHttpsCallableFromUrl should not use limited-use tokens by default` () {
133
+ val callable = Firebase .functions.getHttpsCallableFromUrl(URL (" https://functions.test" ))
134
+ assertThat(callable.usesLimitedUseFacTokens()).isFalse()
135
+ }
136
+
137
+ @Test
138
+ fun `FirebaseFunctions#getHttpsCallableFromUrl callable with FAC settings (when true)` () {
139
+ val callable = Firebase .functions.getHttpsCallableFromUrl(URL (" https://functions.test" )) {
140
+ limitedUseAppCheckTokens = true
141
+ }
142
+ assertThat(callable.usesLimitedUseFacTokens()).isTrue()
143
+ }
144
+
145
+ @Test
146
+ fun `FirebaseFunctions#getHttpsCallableFromUrl callable with FAC settings (when false)` () {
147
+ val callable = Firebase .functions.getHttpsCallableFromUrl(URL (" https://functions.test" )) {
148
+ limitedUseAppCheckTokens = false
149
+ }
150
+ assertThat(callable.usesLimitedUseFacTokens()).isFalse()
151
+ }
141
152
}
0 commit comments