mirror of
https://github.com/bitwarden/android.git
synced 2024-10-31 07:05:35 +03:00
Clean up the PushManager (#1462)
This commit is contained in:
parent
2f2d371a92
commit
3c035924c0
3 changed files with 234 additions and 205 deletions
|
@ -17,6 +17,7 @@ import com.x8bit.bitwarden.data.platform.manager.model.SyncFolderUpsertData
|
|||
import com.x8bit.bitwarden.data.platform.manager.model.SyncSendDeleteData
|
||||
import com.x8bit.bitwarden.data.platform.manager.model.SyncSendUpsertData
|
||||
import com.x8bit.bitwarden.data.platform.repository.util.bufferedMutableSharedFlow
|
||||
import com.x8bit.bitwarden.data.platform.util.decodeFromStringOrNull
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.flow.SharedFlow
|
||||
import kotlinx.coroutines.flow.asSharedFlow
|
||||
|
@ -107,23 +108,15 @@ class PushManagerImpl @Inject constructor(
|
|||
}
|
||||
|
||||
override fun onMessageReceived(data: String) {
|
||||
val notification = try {
|
||||
json.decodeFromString<BitwardenNotification>(data)
|
||||
} catch (exception: IllegalArgumentException) {
|
||||
return
|
||||
}
|
||||
val notification = json.decodeFromStringOrNull<BitwardenNotification>(data) ?: return
|
||||
onMessageReceived(notification)
|
||||
}
|
||||
|
||||
@Suppress("ReturnCount")
|
||||
override fun onMessageReceived(data: Map<String, String>) {
|
||||
val type = data["type"] ?: return
|
||||
val notificationType = data["type"]
|
||||
?.let { json.decodeFromStringOrNull<NotificationType>(string = it) }
|
||||
?: return
|
||||
val payload = data["payload"] ?: return
|
||||
val notificationType = try {
|
||||
json.decodeFromString<NotificationType>(string = type)
|
||||
} catch (exception: IllegalArgumentException) {
|
||||
return
|
||||
}
|
||||
val notification = BitwardenNotification(
|
||||
contextId = data["contextId"],
|
||||
notificationType = notificationType,
|
||||
|
|
|
@ -14,6 +14,6 @@ inline fun <reified T> Json.decodeFromStringOrNull(
|
|||
decodeFromString(string = string)
|
||||
} catch (e: SerializationException) {
|
||||
null
|
||||
} catch (e: IllegalStateException) {
|
||||
} catch (e: IllegalArgumentException) {
|
||||
null
|
||||
}
|
||||
|
|
|
@ -82,17 +82,18 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived json invalid JSON does not crash`() {
|
||||
fun `onMessageReceived for raw data with invalid JSON does not crash`() {
|
||||
pushManager.onMessageReceived(INVALID_NOTIFICATION_JSON)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived map invalid JSON does not crash`() {
|
||||
fun `onMessageReceived for map data with invalid JSON does not crash`() {
|
||||
pushManager.onMessageReceived(INVALID_NOTIFICATION_MAP)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived json auth request emits to passwordlessRequestFlow`() = runTest {
|
||||
fun `onMessageReceived for raw data with auth request emits to passwordlessRequestFlow`() =
|
||||
runTest {
|
||||
pushManager.passwordlessRequestFlow.test {
|
||||
pushManager.onMessageReceived(AUTH_REQUEST_NOTIFICATION_JSON)
|
||||
assertEquals(
|
||||
|
@ -106,7 +107,8 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived map auth request emits to passwordlessRequestFlow`() = runTest {
|
||||
fun `onMessageReceived for map data with auth request emits to passwordlessRequestFlow`() =
|
||||
runTest {
|
||||
pushManager.passwordlessRequestFlow.test {
|
||||
pushManager.onMessageReceived(AUTH_REQUEST_NOTIFICATION_MAP)
|
||||
assertEquals(
|
||||
|
@ -119,8 +121,9 @@ class PushManagerTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Suppress("MaxLineLength")
|
||||
@Test
|
||||
fun `onMessageReceived json auth request response emits to passwordlessRequestFlow`() =
|
||||
fun `onMessageReceived for raw data with auth request response emits to passwordlessRequestFlow`() =
|
||||
runTest {
|
||||
pushManager.passwordlessRequestFlow.test {
|
||||
pushManager.onMessageReceived(AUTH_REQUEST_RESPONSE_NOTIFICATION_JSON)
|
||||
|
@ -134,8 +137,9 @@ class PushManagerTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Suppress("MaxLineLength")
|
||||
@Test
|
||||
fun `onMessageReceived map auth request response emits to passwordlessRequestFlow`() =
|
||||
fun `onMessageReceived for map data with auth request response emits to passwordlessRequestFlow`() =
|
||||
runTest {
|
||||
pushManager.passwordlessRequestFlow.test {
|
||||
pushManager.onMessageReceived(AUTH_REQUEST_RESPONSE_NOTIFICATION_MAP)
|
||||
|
@ -150,7 +154,7 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived json logout should emit to logoutFlow`() = runTest {
|
||||
fun `onMessageReceived for raw data with logout should emit to logoutFlow`() = runTest {
|
||||
val accountTokens = AccountTokensJson(
|
||||
accessToken = "accessToken",
|
||||
refreshToken = "refreshToken",
|
||||
|
@ -168,7 +172,7 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived map logout should emit to logoutFlow`() = runTest {
|
||||
fun `onMessageReceived for map data with logout should emit to logoutFlow`() = runTest {
|
||||
val accountTokens = AccountTokensJson(
|
||||
accessToken = "accessToken",
|
||||
refreshToken = "refreshToken",
|
||||
|
@ -196,7 +200,7 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived json logout emits to logoutFlow`() = runTest {
|
||||
fun `onMessageReceived for raw data with logout emits to logoutFlow`() = runTest {
|
||||
pushManager.logoutFlow.test {
|
||||
pushManager.onMessageReceived(LOGOUT_NOTIFICATION_JSON)
|
||||
assertEquals(
|
||||
|
@ -207,7 +211,7 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived map logout emits to logoutFlow`() = runTest {
|
||||
fun `onMessageReceived for map data with logout emits to logoutFlow`() = runTest {
|
||||
pushManager.logoutFlow.test {
|
||||
pushManager.onMessageReceived(LOGOUT_NOTIFICATION_MAP)
|
||||
assertEquals(
|
||||
|
@ -218,7 +222,8 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived json sync ciphers emits to fullSyncFlow`() = runTest {
|
||||
fun `onMessageReceived for raw data with sync ciphers emits to fullSyncFlow`() =
|
||||
runTest {
|
||||
pushManager.fullSyncFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_CIPHERS_NOTIFICATION_JSON)
|
||||
assertEquals(
|
||||
|
@ -229,7 +234,7 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived map ciphers emits to fullSyncFlow`() = runTest {
|
||||
fun `onMessageReceived for map data with ciphers emits to fullSyncFlow`() = runTest {
|
||||
pushManager.fullSyncFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_CIPHERS_NOTIFICATION_MAP)
|
||||
assertEquals(
|
||||
|
@ -240,7 +245,7 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived json sync org keys does nothing`() = runTest {
|
||||
fun `onMessageReceived for raw data with sync org keys does nothing`() = runTest {
|
||||
pushManager.fullSyncFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_ORG_KEYS_NOTIFICATION_JSON)
|
||||
expectNoEvents()
|
||||
|
@ -248,7 +253,7 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived map sync org keys does nothing`() = runTest {
|
||||
fun `onMessageReceived for map data with sync org keys does nothing`() = runTest {
|
||||
pushManager.fullSyncFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_ORG_KEYS_NOTIFICATION_MAP)
|
||||
expectNoEvents()
|
||||
|
@ -256,7 +261,8 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived json sync settings emits to fullSyncFlow`() = runTest {
|
||||
fun `onMessageReceived for raw data with sync settings emits to fullSyncFlow`() =
|
||||
runTest {
|
||||
pushManager.fullSyncFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_SETTINGS_NOTIFICATION_JSON)
|
||||
assertEquals(
|
||||
|
@ -267,7 +273,8 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived map sync settings emits to fullSyncFlow`() = runTest {
|
||||
fun `onMessageReceived for map data with sync settings emits to fullSyncFlow`() =
|
||||
runTest {
|
||||
pushManager.fullSyncFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_SETTINGS_NOTIFICATION_MAP)
|
||||
assertEquals(
|
||||
|
@ -278,7 +285,7 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived json sync vault emits to fullSyncFlow`() = runTest {
|
||||
fun `onMessageReceived for raw data with sync vault emits to fullSyncFlow`() = runTest {
|
||||
pushManager.fullSyncFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_VAULT_NOTIFICATION_JSON)
|
||||
assertEquals(
|
||||
|
@ -289,7 +296,7 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived map vault emits to fullSyncFlow`() = runTest {
|
||||
fun `onMessageReceived for map data with vault emits to fullSyncFlow`() = runTest {
|
||||
pushManager.fullSyncFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_VAULT_NOTIFICATION_MAP)
|
||||
assertEquals(
|
||||
|
@ -314,8 +321,9 @@ class PushManagerTest {
|
|||
authDiskSource.userState = UserStateJson(userId, mapOf(userId to account))
|
||||
}
|
||||
|
||||
@Suppress("MaxLineLength")
|
||||
@Test
|
||||
fun `onMessageReceived json sync cipher create emits to syncCipherUpsertFlow`() =
|
||||
fun `onMessageReceived for raw data with sync cipher create emits to syncCipherUpsertFlow`() =
|
||||
runTest {
|
||||
pushManager.syncCipherUpsertFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_CIPHER_CREATE_NOTIFICATION_JSON)
|
||||
|
@ -332,8 +340,9 @@ class PushManagerTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Suppress("MaxLineLength")
|
||||
@Test
|
||||
fun `onMessageReceived map sync cipher create emits to syncCipherUpsertFlow`() =
|
||||
fun `onMessageReceived for map data with sync cipher create emits to syncCipherUpsertFlow`() =
|
||||
runTest {
|
||||
pushManager.syncCipherUpsertFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_CIPHER_CREATE_NOTIFICATION_MAP)
|
||||
|
@ -350,8 +359,9 @@ class PushManagerTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Suppress("MaxLineLength")
|
||||
@Test
|
||||
fun `onMessageReceived json sync cipher delete emits to syncCipherDeleteFlow`() =
|
||||
fun `onMessageReceived for raw data with sync cipher delete emits to syncCipherDeleteFlow`() =
|
||||
runTest {
|
||||
pushManager.syncCipherDeleteFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_CIPHER_DELETE_NOTIFICATION_JSON)
|
||||
|
@ -364,8 +374,9 @@ class PushManagerTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Suppress("MaxLineLength")
|
||||
@Test
|
||||
fun `onMessageReceived map sync cipher delete emits to syncCipherDeleteFlow`() =
|
||||
fun `onMessageReceived for map data with sync cipher delete emits to syncCipherDeleteFlow`() =
|
||||
runTest {
|
||||
pushManager.syncCipherDeleteFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_CIPHER_DELETE_NOTIFICATION_MAP)
|
||||
|
@ -378,8 +389,9 @@ class PushManagerTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Suppress("MaxLineLength")
|
||||
@Test
|
||||
fun `onMessageReceived json sync cipher update emits to syncCipherUpsertFlow`() =
|
||||
fun `onMessageReceived for raw data with sync cipher update emits to syncCipherUpsertFlow`() =
|
||||
runTest {
|
||||
pushManager.syncCipherUpsertFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_CIPHER_UPDATE_NOTIFICATION_JSON)
|
||||
|
@ -396,8 +408,9 @@ class PushManagerTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Suppress("MaxLineLength")
|
||||
@Test
|
||||
fun `onMessageReceived map sync cipher update emits to syncCipherUpsertFlow`() =
|
||||
fun `onMessageReceived for map data with sync cipher update emits to syncCipherUpsertFlow`() =
|
||||
runTest {
|
||||
pushManager.syncCipherUpsertFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_CIPHER_UPDATE_NOTIFICATION_MAP)
|
||||
|
@ -414,8 +427,9 @@ class PushManagerTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Suppress("MaxLineLength")
|
||||
@Test
|
||||
fun `onMessageReceived json sync folder create emits to syncFolderUpsertFlow`() =
|
||||
fun `onMessageReceived for raw data with sync folder create emits to syncFolderUpsertFlow`() =
|
||||
runTest {
|
||||
pushManager.syncFolderUpsertFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_FOLDER_CREATE_NOTIFICATION_JSON)
|
||||
|
@ -430,8 +444,9 @@ class PushManagerTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Suppress("MaxLineLength")
|
||||
@Test
|
||||
fun `onMessageReceived map sync folder create emits to syncFolderUpsertFlow`() =
|
||||
fun `onMessageReceived for map data with sync folder create emits to syncFolderUpsertFlow`() =
|
||||
runTest {
|
||||
pushManager.syncFolderUpsertFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_FOLDER_CREATE_NOTIFICATION_MAP)
|
||||
|
@ -446,8 +461,9 @@ class PushManagerTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Suppress("MaxLineLength")
|
||||
@Test
|
||||
fun `onMessageReceived json sync folder delete emits to syncFolderDeleteFlow`() =
|
||||
fun `onMessageReceived for raw data with sync folder delete emits to syncFolderDeleteFlow`() =
|
||||
runTest {
|
||||
pushManager.syncFolderDeleteFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_FOLDER_DELETE_NOTIFICATION_JSON)
|
||||
|
@ -460,8 +476,9 @@ class PushManagerTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Suppress("MaxLineLength")
|
||||
@Test
|
||||
fun `onMessageReceived map sync folder delete emits to syncFolderDeleteFlow`() =
|
||||
fun `onMessageReceived for map data with sync folder delete emits to syncFolderDeleteFlow`() =
|
||||
runTest {
|
||||
pushManager.syncFolderDeleteFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_FOLDER_DELETE_NOTIFICATION_MAP)
|
||||
|
@ -474,8 +491,9 @@ class PushManagerTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Suppress("MaxLineLength")
|
||||
@Test
|
||||
fun `onMessageReceived json sync folder update emits to syncFolderUpsertFlow`() =
|
||||
fun `onMessageReceived for raw data with sync folder update emits to syncFolderUpsertFlow`() =
|
||||
runTest {
|
||||
pushManager.syncFolderUpsertFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_FOLDER_UPDATE_NOTIFICATION_JSON)
|
||||
|
@ -490,8 +508,9 @@ class PushManagerTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Suppress("MaxLineLength")
|
||||
@Test
|
||||
fun `onMessageReceived map sync folder update emits to syncFolderUpsertFlow`() =
|
||||
fun `onMessageReceived for map data with sync folder update emits to syncFolderUpsertFlow`() =
|
||||
runTest {
|
||||
pushManager.syncFolderUpsertFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_FOLDER_UPDATE_NOTIFICATION_MAP)
|
||||
|
@ -506,8 +525,9 @@ class PushManagerTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Suppress("MaxLineLength")
|
||||
@Test
|
||||
fun `onMessageReceived json sync login delete emits to syncCipherDeleteFlow`() =
|
||||
fun `onMessageReceived for raw data with sync login delete emits to syncCipherDeleteFlow`() =
|
||||
runTest {
|
||||
pushManager.syncCipherDeleteFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_LOGIN_DELETE_NOTIFICATION_JSON)
|
||||
|
@ -520,8 +540,9 @@ class PushManagerTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Suppress("MaxLineLength")
|
||||
@Test
|
||||
fun `onMessageReceived map sync login delete emits to syncCipherDeleteFlow`() =
|
||||
fun `onMessageReceived for map data with sync login delete emits to syncCipherDeleteFlow`() =
|
||||
runTest {
|
||||
pushManager.syncCipherDeleteFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_LOGIN_DELETE_NOTIFICATION_MAP)
|
||||
|
@ -534,8 +555,9 @@ class PushManagerTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Suppress("MaxLineLength")
|
||||
@Test
|
||||
fun `onMessageReceived json sync send create emits to syncSendUpsertFlow`() =
|
||||
fun `onMessageReceived for raw data with sync send create emits to syncSendUpsertFlow`() =
|
||||
runTest {
|
||||
pushManager.syncSendUpsertFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_SEND_CREATE_NOTIFICATION_JSON)
|
||||
|
@ -550,8 +572,10 @@ class PushManagerTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Suppress("MaxLineLength")
|
||||
@Test
|
||||
fun `onMessageReceived map sync send create emits to syncSendUpsertFlow`() = runTest {
|
||||
fun `onMessageReceived for map data with sync send create emits to syncSendUpsertFlow`() =
|
||||
runTest {
|
||||
pushManager.syncSendUpsertFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_SEND_CREATE_NOTIFICATION_MAP)
|
||||
assertEquals(
|
||||
|
@ -565,8 +589,9 @@ class PushManagerTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Suppress("MaxLineLength")
|
||||
@Test
|
||||
fun `onMessageReceived json sync send delete emits to syncSendDeleteFlow`() =
|
||||
fun `onMessageReceived for raw data with sync send delete emits to syncSendDeleteFlow`() =
|
||||
runTest {
|
||||
pushManager.syncSendDeleteFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_SEND_DELETE_NOTIFICATION_JSON)
|
||||
|
@ -579,8 +604,10 @@ class PushManagerTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Suppress("MaxLineLength")
|
||||
@Test
|
||||
fun `onMessageReceived map sync send delete emits to syncSendDeleteFlow`() = runTest {
|
||||
fun `onMessageReceived for map data with sync send delete emits to syncSendDeleteFlow`() =
|
||||
runTest {
|
||||
pushManager.syncSendDeleteFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_SEND_DELETE_NOTIFICATION_MAP)
|
||||
assertEquals(
|
||||
|
@ -592,8 +619,9 @@ class PushManagerTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Suppress("MaxLineLength")
|
||||
@Test
|
||||
fun `onMessageReceived json sync send update emits to syncSendUpsertFlow`() =
|
||||
fun `onMessageReceived for raw data with sync send update emits to syncSendUpsertFlow`() =
|
||||
runTest {
|
||||
pushManager.syncSendUpsertFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_SEND_UPDATE_NOTIFICATION_JSON)
|
||||
|
@ -608,8 +636,10 @@ class PushManagerTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Suppress("MaxLineLength")
|
||||
@Test
|
||||
fun `onMessageReceived map sync send update emits to syncSendUpsertFlow`() = runTest {
|
||||
fun `onMessageReceived for map data with sync send update emits to syncSendUpsertFlow`() =
|
||||
runTest {
|
||||
pushManager.syncSendUpsertFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_SEND_UPDATE_NOTIFICATION_MAP)
|
||||
assertEquals(
|
||||
|
@ -639,7 +669,7 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived json sync cipher create does nothing`() = runTest {
|
||||
fun `onMessageReceived for raw data with sync cipher create does nothing`() = runTest {
|
||||
pushManager.syncCipherUpsertFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_CIPHER_CREATE_NOTIFICATION_JSON)
|
||||
expectNoEvents()
|
||||
|
@ -647,7 +677,7 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived map sync cipher create does nothing`() = runTest {
|
||||
fun `onMessageReceived for map data with sync cipher create does nothing`() = runTest {
|
||||
pushManager.syncCipherUpsertFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_CIPHER_CREATE_NOTIFICATION_MAP)
|
||||
expectNoEvents()
|
||||
|
@ -655,7 +685,7 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived json sync cipher delete does nothing`() = runTest {
|
||||
fun `onMessageReceived for raw data with sync cipher delete does nothing`() = runTest {
|
||||
pushManager.syncCipherDeleteFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_CIPHER_DELETE_NOTIFICATION_JSON)
|
||||
expectNoEvents()
|
||||
|
@ -663,7 +693,7 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived map sync cipher delete does nothing`() = runTest {
|
||||
fun `onMessageReceived for map data with sync cipher delete does nothing`() = runTest {
|
||||
pushManager.syncCipherDeleteFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_CIPHER_DELETE_NOTIFICATION_MAP)
|
||||
expectNoEvents()
|
||||
|
@ -671,7 +701,7 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived json sync cipher update does nothing`() = runTest {
|
||||
fun `onMessageReceived for raw data with sync cipher update does nothing`() = runTest {
|
||||
pushManager.syncCipherUpsertFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_CIPHER_UPDATE_NOTIFICATION_JSON)
|
||||
expectNoEvents()
|
||||
|
@ -679,7 +709,7 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived map sync cipher update does nothing`() = runTest {
|
||||
fun `onMessageReceived for map data with sync cipher update does nothing`() = runTest {
|
||||
pushManager.syncCipherUpsertFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_CIPHER_UPDATE_NOTIFICATION_MAP)
|
||||
expectNoEvents()
|
||||
|
@ -687,7 +717,7 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived json sync folder create does nothing`() = runTest {
|
||||
fun `onMessageReceived for raw data with sync folder create does nothing`() = runTest {
|
||||
pushManager.syncFolderUpsertFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_FOLDER_CREATE_NOTIFICATION_JSON)
|
||||
expectNoEvents()
|
||||
|
@ -695,7 +725,7 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived map sync folder create does nothing`() = runTest {
|
||||
fun `onMessageReceived for map data with sync folder create does nothing`() = runTest {
|
||||
pushManager.syncFolderUpsertFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_FOLDER_CREATE_NOTIFICATION_MAP)
|
||||
expectNoEvents()
|
||||
|
@ -703,7 +733,7 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived json sync folder delete does nothing`() = runTest {
|
||||
fun `onMessageReceived for raw data with sync folder delete does nothing`() = runTest {
|
||||
pushManager.syncFolderDeleteFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_FOLDER_DELETE_NOTIFICATION_JSON)
|
||||
expectNoEvents()
|
||||
|
@ -711,7 +741,7 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived map sync folder delete does nothing`() = runTest {
|
||||
fun `onMessageReceived for map data with sync folder delete does nothing`() = runTest {
|
||||
pushManager.syncFolderDeleteFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_FOLDER_DELETE_NOTIFICATION_MAP)
|
||||
expectNoEvents()
|
||||
|
@ -719,7 +749,7 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived json sync folder update does nothing`() = runTest {
|
||||
fun `onMessageReceived for raw data with sync folder update does nothing`() = runTest {
|
||||
pushManager.syncFolderDeleteFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_FOLDER_UPDATE_NOTIFICATION_JSON)
|
||||
expectNoEvents()
|
||||
|
@ -727,7 +757,7 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived map sync folder update does nothing`() = runTest {
|
||||
fun `onMessageReceived for map data with sync folder update does nothing`() = runTest {
|
||||
pushManager.syncFolderDeleteFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_FOLDER_UPDATE_NOTIFICATION_MAP)
|
||||
expectNoEvents()
|
||||
|
@ -735,7 +765,7 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived json sync login delete does nothing`() = runTest {
|
||||
fun `onMessageReceived for raw data with sync login delete does nothing`() = runTest {
|
||||
pushManager.syncCipherDeleteFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_LOGIN_DELETE_NOTIFICATION_JSON)
|
||||
expectNoEvents()
|
||||
|
@ -743,7 +773,7 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived map sync login delete does nothing`() = runTest {
|
||||
fun `onMessageReceived for map data with sync login delete does nothing`() = runTest {
|
||||
pushManager.syncCipherDeleteFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_LOGIN_DELETE_NOTIFICATION_MAP)
|
||||
expectNoEvents()
|
||||
|
@ -751,7 +781,7 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived json sync send create does nothing`() = runTest {
|
||||
fun `onMessageReceived for raw data with sync send create does nothing`() = runTest {
|
||||
pushManager.syncSendUpsertFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_SEND_CREATE_NOTIFICATION_JSON)
|
||||
expectNoEvents()
|
||||
|
@ -759,7 +789,7 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived map sync send create does nothing`() = runTest {
|
||||
fun `onMessageReceived for map data with sync send create does nothing`() = runTest {
|
||||
pushManager.syncSendUpsertFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_SEND_CREATE_NOTIFICATION_MAP)
|
||||
expectNoEvents()
|
||||
|
@ -767,7 +797,7 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived json sync send delete does nothing`() = runTest {
|
||||
fun `onMessageReceived for raw data with sync send delete does nothing`() = runTest {
|
||||
pushManager.syncSendDeleteFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_SEND_DELETE_NOTIFICATION_JSON)
|
||||
expectNoEvents()
|
||||
|
@ -775,7 +805,7 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived map sync send delete does nothing`() = runTest {
|
||||
fun `onMessageReceived for map data with sync send delete does nothing`() = runTest {
|
||||
pushManager.syncSendDeleteFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_SEND_DELETE_NOTIFICATION_MAP)
|
||||
expectNoEvents()
|
||||
|
@ -783,7 +813,7 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived json sync send update does nothing`() = runTest {
|
||||
fun `onMessageReceived for raw data with sync send update does nothing`() = runTest {
|
||||
pushManager.syncSendUpsertFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_SEND_UPDATE_NOTIFICATION_JSON)
|
||||
expectNoEvents()
|
||||
|
@ -791,7 +821,7 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived map sync send update does nothing`() = runTest {
|
||||
fun `onMessageReceived for map data with sync send update does nothing`() = runTest {
|
||||
pushManager.syncSendUpsertFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_SEND_UPDATE_NOTIFICATION_MAP)
|
||||
expectNoEvents()
|
||||
|
@ -807,7 +837,7 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived json logout does nothing`() = runTest {
|
||||
fun `onMessageReceived for raw data with logout does nothing`() = runTest {
|
||||
pushManager.logoutFlow.test {
|
||||
pushManager.onMessageReceived(LOGOUT_NOTIFICATION_JSON)
|
||||
expectNoEvents()
|
||||
|
@ -815,7 +845,7 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived map logout does nothing`() = runTest {
|
||||
fun `onMessageReceived for map data with logout does nothing`() = runTest {
|
||||
pushManager.logoutFlow.test {
|
||||
pushManager.onMessageReceived(LOGOUT_NOTIFICATION_MAP)
|
||||
expectNoEvents()
|
||||
|
@ -823,7 +853,7 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived json sync ciphers does nothing`() = runTest {
|
||||
fun `onMessageReceived for raw data with sync ciphers does nothing`() = runTest {
|
||||
pushManager.fullSyncFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_CIPHERS_NOTIFICATION_JSON)
|
||||
expectNoEvents()
|
||||
|
@ -831,7 +861,7 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived map sync ciphers does nothing`() = runTest {
|
||||
fun `onMessageReceived for map data with sync ciphers does nothing`() = runTest {
|
||||
pushManager.fullSyncFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_CIPHERS_NOTIFICATION_MAP)
|
||||
expectNoEvents()
|
||||
|
@ -839,7 +869,7 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived json sync org keys does nothing`() = runTest {
|
||||
fun `onMessageReceived for raw data with sync org keys does nothing`() = runTest {
|
||||
pushManager.fullSyncFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_ORG_KEYS_NOTIFICATION_JSON)
|
||||
expectNoEvents()
|
||||
|
@ -847,7 +877,7 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived map sync org keys does nothing`() = runTest {
|
||||
fun `onMessageReceived for map data with sync org keys does nothing`() = runTest {
|
||||
pushManager.fullSyncFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_ORG_KEYS_NOTIFICATION_MAP)
|
||||
expectNoEvents()
|
||||
|
@ -855,7 +885,7 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived json sync settings does nothing`() = runTest {
|
||||
fun `onMessageReceived for raw data with sync settings does nothing`() = runTest {
|
||||
pushManager.fullSyncFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_SETTINGS_NOTIFICATION_JSON)
|
||||
expectNoEvents()
|
||||
|
@ -863,7 +893,7 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived map sync settings does nothing`() = runTest {
|
||||
fun `onMessageReceived for map data with sync settings does nothing`() = runTest {
|
||||
pushManager.fullSyncFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_SETTINGS_NOTIFICATION_MAP)
|
||||
expectNoEvents()
|
||||
|
@ -871,7 +901,7 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived json sync vault does nothing`() = runTest {
|
||||
fun `onMessageReceived for raw data with sync vault does nothing`() = runTest {
|
||||
pushManager.fullSyncFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_VAULT_NOTIFICATION_JSON)
|
||||
expectNoEvents()
|
||||
|
@ -879,7 +909,7 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived map sync vault does nothing`() = runTest {
|
||||
fun `onMessageReceived for map data with sync vault does nothing`() = runTest {
|
||||
pushManager.fullSyncFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_VAULT_NOTIFICATION_MAP)
|
||||
expectNoEvents()
|
||||
|
@ -902,7 +932,7 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived json logout emits to logoutFlow`() = runTest {
|
||||
fun `onMessageReceived for raw data with logout emits to logoutFlow`() = runTest {
|
||||
pushManager.logoutFlow.test {
|
||||
pushManager.onMessageReceived(LOGOUT_NOTIFICATION_JSON)
|
||||
assertEquals(
|
||||
|
@ -913,7 +943,7 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived map logout emits to logoutFlow`() = runTest {
|
||||
fun `onMessageReceived for map data with logout emits to logoutFlow`() = runTest {
|
||||
pushManager.logoutFlow.test {
|
||||
pushManager.onMessageReceived(LOGOUT_NOTIFICATION_MAP)
|
||||
assertEquals(
|
||||
|
@ -924,7 +954,8 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived json sync ciphers emits to fullSyncFlow`() = runTest {
|
||||
fun `onMessageReceived for raw data with sync ciphers emits to fullSyncFlow`() =
|
||||
runTest {
|
||||
pushManager.fullSyncFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_CIPHERS_NOTIFICATION_JSON)
|
||||
assertEquals(
|
||||
|
@ -935,7 +966,8 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived map sync ciphers emits to fullSyncFlow`() = runTest {
|
||||
fun `onMessageReceived for map data with sync ciphers emits to fullSyncFlow`() =
|
||||
runTest {
|
||||
pushManager.fullSyncFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_CIPHERS_NOTIFICATION_MAP)
|
||||
assertEquals(
|
||||
|
@ -946,7 +978,8 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived json sync org keys emits to syncOrgKeysFlow`() = runTest {
|
||||
fun `onMessageReceived for raw data with sync org keys emits to syncOrgKeysFlow`() =
|
||||
runTest {
|
||||
pushManager.syncOrgKeysFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_ORG_KEYS_NOTIFICATION_JSON)
|
||||
assertEquals(
|
||||
|
@ -957,7 +990,8 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived map sync org keys emits to syncOrgKeysFlow`() = runTest {
|
||||
fun `onMessageReceived for map data with sync org keys emits to syncOrgKeysFlow`() =
|
||||
runTest {
|
||||
pushManager.syncOrgKeysFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_ORG_KEYS_NOTIFICATION_MAP)
|
||||
assertEquals(
|
||||
|
@ -968,7 +1002,8 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived json sync settings emits to fullSyncFlow`() = runTest {
|
||||
fun `onMessageReceived for raw data with sync settings emits to fullSyncFlow`() =
|
||||
runTest {
|
||||
pushManager.fullSyncFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_SETTINGS_NOTIFICATION_JSON)
|
||||
assertEquals(
|
||||
|
@ -979,7 +1014,8 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived map sync settings emits to fullSyncFlow`() = runTest {
|
||||
fun `onMessageReceived for map data with sync settings emits to fullSyncFlow`() =
|
||||
runTest {
|
||||
pushManager.fullSyncFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_SETTINGS_NOTIFICATION_MAP)
|
||||
assertEquals(
|
||||
|
@ -990,7 +1026,7 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived json sync vault emits to fullSyncFlow`() = runTest {
|
||||
fun `onMessageReceived for raw data with sync vault emits to fullSyncFlow`() = runTest {
|
||||
pushManager.fullSyncFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_VAULT_NOTIFICATION_JSON)
|
||||
assertEquals(
|
||||
|
@ -1001,7 +1037,7 @@ class PushManagerTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
fun `onMessageReceived map sync vault emits to fullSyncFlow`() = runTest {
|
||||
fun `onMessageReceived for map data with sync vault emits to fullSyncFlow`() = runTest {
|
||||
pushManager.fullSyncFlow.test {
|
||||
pushManager.onMessageReceived(SYNC_VAULT_NOTIFICATION_MAP)
|
||||
assertEquals(
|
||||
|
|
Loading…
Reference in a new issue