File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
firebase-dataconnect/src/test/kotlin/com/google/firebase/dataconnect/core Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -223,6 +223,30 @@ class DataConnectAuthUnitTest {
223
223
dataConnectAuth.forceRefresh()
224
224
}
225
225
226
+ @Test
227
+ fun `forceRefresh() should throw if invoked before initialize() close()` () = runTest {
228
+ val dataConnectAuth = newDataConnectAuth()
229
+
230
+ val exception = shouldThrow<IllegalStateException > { dataConnectAuth.forceRefresh() }
231
+
232
+ assertSoftly {
233
+ exception.message shouldContainWithNonAbuttingText " forceRefresh()"
234
+ exception.message shouldContainWithNonAbuttingTextIgnoringCase " initialize() must be called"
235
+ }
236
+ }
237
+
238
+ @Test
239
+ fun `getToken() should throw if invoked before initialize() close()` () = runTest {
240
+ val dataConnectAuth = newDataConnectAuth()
241
+
242
+ val exception = shouldThrow<IllegalStateException > { dataConnectAuth.getToken(requestId) }
243
+
244
+ assertSoftly {
245
+ exception.message shouldContainWithNonAbuttingText " getToken()"
246
+ exception.message shouldContainWithNonAbuttingTextIgnoringCase " initialize() must be called"
247
+ }
248
+ }
249
+
226
250
@Test
227
251
fun `getToken() should return null if InternalAuthProvider is not available` () = runTest {
228
252
val dataConnectAuth = newDataConnectAuth(deferredInternalAuthProvider = UnavailableDeferred ())
You can’t perform that action at this time.
0 commit comments