-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathAppViewModelSendFlowTest.kt
More file actions
577 lines (497 loc) · 21.6 KB
/
Copy pathAppViewModelSendFlowTest.kt
File metadata and controls
577 lines (497 loc) · 21.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
package to.bitkit.viewmodels
import android.content.Context
import app.cash.turbine.test
import com.synonym.bitkitcore.LightningInvoice
import com.synonym.bitkitcore.NetworkType
import com.synonym.bitkitcore.Scanner
import kotlinx.collections.immutable.persistentListOf
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.test.advanceUntilIdle
import org.junit.Before
import org.junit.Test
import org.lightningdevkit.ldknode.Event
import org.mockito.kotlin.any
import org.mockito.kotlin.anyOrNull
import org.mockito.kotlin.clearInvocations
import org.mockito.kotlin.mock
import org.mockito.kotlin.never
import org.mockito.kotlin.verify
import org.mockito.kotlin.whenever
import to.bitkit.data.AppCacheData
import to.bitkit.data.CacheStore
import to.bitkit.data.SettingsData
import to.bitkit.data.SettingsStore
import to.bitkit.data.keychain.Keychain
import to.bitkit.domain.commands.NotifyPaymentReceivedHandler
import to.bitkit.models.BalanceState
import to.bitkit.models.TransactionSpeed
import to.bitkit.repositories.ActivityRepo
import to.bitkit.repositories.BackupRepo
import to.bitkit.repositories.BlocktankRepo
import to.bitkit.repositories.BlocktankState
import to.bitkit.repositories.ConnectivityRepo
import to.bitkit.repositories.ConnectivityState
import to.bitkit.repositories.CurrencyRepo
import to.bitkit.repositories.HealthRepo
import to.bitkit.repositories.LightningRepo
import to.bitkit.repositories.LightningState
import to.bitkit.repositories.PendingPaymentRepo
import to.bitkit.repositories.PendingPaymentResolution
import to.bitkit.repositories.PreActivityMetadataRepo
import to.bitkit.repositories.PubkyRepo
import to.bitkit.repositories.PublicPaykitRepo
import to.bitkit.repositories.TransferRepo
import to.bitkit.repositories.WalletRepo
import to.bitkit.repositories.WalletState
import to.bitkit.repositories.WidgetsRepo
import to.bitkit.services.AppUpdaterService
import to.bitkit.services.CoreService
import to.bitkit.services.MigrationService
import to.bitkit.test.BaseUnitTest
import to.bitkit.ui.Routes
import to.bitkit.ui.components.Sheet
import to.bitkit.ui.shared.toast.ToastQueueManager
import to.bitkit.ui.sheets.SendRoute
import to.bitkit.usecases.FormatMoneyValue
import to.bitkit.utils.timedsheets.TimedSheetManager
import kotlin.test.assertEquals
import kotlin.test.assertFalse
import kotlin.test.assertNull
import kotlin.test.assertTrue
@OptIn(ExperimentalCoroutinesApi::class)
class AppViewModelSendFlowTest : BaseUnitTest() {
private lateinit var sut: AppViewModel
private val context = mock<Context>()
private val lightningRepo = mock<LightningRepo>()
private val walletRepo = mock<WalletRepo>()
private val settingsStore = mock<SettingsStore>()
private val currencyRepo = mock<CurrencyRepo>()
private val connectivityRepo = mock<ConnectivityRepo>()
private val healthRepo = mock<HealthRepo>()
private val pendingPaymentRepo = mock<PendingPaymentRepo>()
private val backupRepo = mock<BackupRepo>()
private val activityRepo = mock<ActivityRepo>()
private val preActivityMetadataRepo = mock<PreActivityMetadataRepo>()
private val blocktankRepo = mock<BlocktankRepo>()
private val appUpdaterService = mock<AppUpdaterService>()
private val notifyPaymentReceivedHandler = mock<NotifyPaymentReceivedHandler>()
private val cacheStore = mock<CacheStore>()
private val transferRepo = mock<TransferRepo>()
private val migrationService = mock<MigrationService>()
private val coreService = mock<CoreService>()
private val keychain = mock<Keychain>()
private val pubkyRepo = mock<PubkyRepo>()
private val publicPaykitRepo = mock<PublicPaykitRepo>()
private val widgetsRepo = mock<WidgetsRepo>()
private val formatMoneyValue = mock<FormatMoneyValue>()
private val balanceState = MutableStateFlow(BalanceState())
private val settingsData = MutableStateFlow(SettingsData())
private val walletState = MutableStateFlow(WalletState())
private val nodeEvents = MutableSharedFlow<Event>()
private val testPublicKey = "pubky3rsduhcxpw74snwyct86m38c63j3pq8x4ycqikxg64roik8yw5xg"
private val timedSheetManager = mock<TimedSheetManager>()
@Before
fun setUp() {
stubRepositories()
sut = createViewModel()
}
private fun stubRepositories() {
whenever(context.getString(any())).thenReturn("")
whenever(connectivityRepo.isOnline).thenReturn(MutableStateFlow(ConnectivityState.CONNECTED))
whenever(healthRepo.healthState).thenReturn(MutableStateFlow(mock()))
whenever(lightningRepo.lightningState).thenReturn(MutableStateFlow(LightningState()))
whenever(lightningRepo.nodeEvents).thenReturn(nodeEvents)
whenever(walletRepo.balanceState).thenReturn(balanceState)
whenever(walletRepo.walletState).thenReturn(walletState)
whenever(walletRepo.walletExists()).thenReturn(true)
whenever(settingsStore.data).thenReturn(settingsData)
whenever(cacheStore.data).thenReturn(flowOf(AppCacheData()))
whenever(transferRepo.activeTransfers).thenReturn(flowOf(emptyList()))
whenever(blocktankRepo.blocktankState).thenReturn(MutableStateFlow(BlocktankState()))
whenever { blocktankRepo.refreshInfo() }.thenReturn(Result.success(Unit))
whenever(timedSheetManager.currentSheet).thenReturn(MutableStateFlow(null))
whenever(migrationService.isShowingMigrationLoading).thenReturn(MutableStateFlow(false))
whenever { migrationService.needsPostMigrationSync() }.thenReturn(false)
whenever { migrationService.isMigrationChecked() }.thenReturn(true)
whenever { widgetsRepo.refreshEnabledWidgets() }.thenReturn(Unit)
whenever { lightningRepo.updateGeoBlockState() }.thenReturn(Unit)
whenever(pubkyRepo.sessionRestorationFailed).thenReturn(MutableStateFlow(false))
whenever(pubkyRepo.publicKey).thenReturn(MutableStateFlow(null))
whenever(pubkyRepo.contacts).thenReturn(MutableStateFlow(emptyList()))
whenever(currencyRepo.convertSatsToFiat(any(), anyOrNull()))
.thenReturn(Result.failure(Exception("not mocked")))
whenever { lightningRepo.calculateTotalFee(any(), anyOrNull(), any(), anyOrNull(), anyOrNull()) }
.thenReturn(Result.success(100uL))
whenever { lightningRepo.getFeeRateForSpeed(any(), anyOrNull()) }
.thenReturn(Result.success(2u))
whenever { lightningRepo.canSend(any(), any()) }.thenReturn(true)
}
private fun createViewModel() = AppViewModel(
connectivityRepo = connectivityRepo,
healthRepo = healthRepo,
toastManagerProvider = { mock<ToastQueueManager>() },
timedSheetManagerProvider = { timedSheetManager },
context = context,
bgDispatcher = testDispatcher,
keychain = keychain,
lightningRepo = lightningRepo,
pendingPaymentRepo = pendingPaymentRepo,
walletRepo = walletRepo,
backupRepo = backupRepo,
settingsStore = settingsStore,
currencyRepo = currencyRepo,
activityRepo = activityRepo,
preActivityMetadataRepo = preActivityMetadataRepo,
blocktankRepo = blocktankRepo,
appUpdaterService = appUpdaterService,
notifyPaymentReceivedHandler = notifyPaymentReceivedHandler,
cacheStore = cacheStore,
transferRepo = transferRepo,
migrationService = migrationService,
coreService = coreService,
publicPaykitRepo = publicPaykitRepo,
appUpdateSheet = mock(),
backupSheet = mock(),
notificationsSheet = mock(),
quickPaySheet = mock(),
highBalanceSheet = mock(),
formatMoneyValue = formatMoneyValue,
widgetsRepo = widgetsRepo,
pubkyRepo = pubkyRepo,
)
@Test
fun `canSwitchWallet is false when not unified`() = test {
sut.setSendEvent(SendEvent.AmountChange(1000u))
advanceUntilIdle()
assertFalse(sut.sendUiState.value.canSwitchWallet)
}
@Test
fun `canSwitchWallet is false when amount is zero`() = test {
setUnifiedState(amount = 0u)
advanceUntilIdle()
assertFalse(sut.sendUiState.value.canSwitchWallet)
}
@Test
fun `canSwitchWallet is false when amount equals dust limit`() = test {
balanceState.value = BalanceState(
maxSendOnchainSats = 100_000u,
maxSendLightningSats = 100_000u,
)
setUnifiedState(amount = 546u)
advanceUntilIdle()
assertFalse(sut.sendUiState.value.canSwitchWallet)
}
@Test
fun `canSwitchWallet is true when amount above dust limit and within both balances`() = test {
balanceState.value = BalanceState(
maxSendOnchainSats = 100_000u,
maxSendLightningSats = 100_000u,
)
setUnifiedState(amount = 1000u)
advanceUntilIdle()
assertTrue(sut.sendUiState.value.canSwitchWallet)
}
@Test
fun `canSwitchWallet is false when amount exceeds onchain balance`() = test {
balanceState.value = BalanceState(
maxSendOnchainSats = 500u,
maxSendLightningSats = 100_000u,
)
setUnifiedState(amount = 1000u)
advanceUntilIdle()
assertFalse(sut.sendUiState.value.canSwitchWallet)
}
@Test
fun `manual address continue routes pubky to add contact`() = test {
sut.mainScreenEffect.test {
sut.setSendEvent(SendEvent.AddressContinue(testPublicKey))
assertEquals(MainScreenEffect.Navigate(Routes.AddContact(testPublicKey)), awaitItem())
}
}
@Test
fun `manual address input accepts pubky without decode error`() = test {
sut.setSendEvent(SendEvent.AddressChange(testPublicKey))
advanceUntilIdle()
assertEquals(testPublicKey, sut.sendUiState.value.addressInput)
assertTrue(sut.sendUiState.value.isAddressInputValid)
verify(coreService, never()).decode(any())
}
@Test
fun `pubky routing dismisses send sheet before navigation`() = test {
sut.showSheet(Sheet.Send())
advanceUntilIdle()
sut.mainScreenEffect.test {
sut.setSendEvent(SendEvent.AddressContinue(testPublicKey))
assertEquals(MainScreenEffect.Navigate(Routes.AddContact(testPublicKey)), awaitItem())
assertNull(sut.currentSheet.value)
}
}
@Test
fun `canSwitchWallet is false when amount exceeds lightning balance`() = test {
balanceState.value = BalanceState(
maxSendOnchainSats = 100_000u,
maxSendLightningSats = 500u,
)
setUnifiedState(amount = 1000u)
advanceUntilIdle()
assertFalse(sut.sendUiState.value.canSwitchWallet)
}
@Test
fun `switch from lightning to onchain resets confirmedWarnings`() = test {
balanceState.value = BalanceState(
maxSendOnchainSats = 100_000u,
maxSendLightningSats = 100_000u,
)
setUnifiedState(amount = 1000u, payMethod = SendMethod.LIGHTNING)
sut.setSendEvent(SendEvent.ConfirmAmountWarning(SanityWarning.VALUE_OVER_100_USD))
advanceUntilIdle()
assertTrue(sut.sendUiState.value.confirmedWarnings.isNotEmpty())
sut.setSendEvent(SendEvent.PaymentMethodSwitch)
advanceUntilIdle()
assertTrue(sut.sendUiState.value.confirmedWarnings.isEmpty())
}
@Test
fun `switch from onchain to lightning sets fee to Lightning zero`() = test {
balanceState.value = BalanceState(
maxSendOnchainSats = 100_000u,
maxSendLightningSats = 100_000u,
)
setUnifiedState(amount = 1000u, payMethod = SendMethod.ONCHAIN)
advanceUntilIdle()
sut.setSendEvent(SendEvent.PaymentMethodSwitch)
advanceUntilIdle()
assertEquals(SendMethod.LIGHTNING, sut.sendUiState.value.payMethod)
assertEquals(SendFee.Lightning(0), sut.sendUiState.value.fee)
}
@Test
fun `switch does nothing when not unified`() = test {
sut.setSendEvent(SendEvent.AmountChange(1000u))
advanceUntilIdle()
val before = sut.sendUiState.value.payMethod
sut.setSendEvent(SendEvent.PaymentMethodSwitch)
advanceUntilIdle()
assertEquals(before, sut.sendUiState.value.payMethod)
}
@Test
fun `pending contact lightning success tags activity`() = test {
val contactKey = "pubkycontact"
val paymentHash = "pending_hash"
whenever(pendingPaymentRepo.isPending(paymentHash)).thenReturn(true)
whenever(pendingPaymentRepo.isActive(paymentHash)).thenReturn(false)
whenever(activityRepo.setContact(contactKey, paymentHash)).thenReturn(Result.success(Unit))
advanceUntilIdle()
setPendingContactPaymentContext(paymentHash, contactKey)
nodeEvents.emit(
Event.PaymentSuccessful(
paymentId = "payment_id",
paymentHash = paymentHash,
paymentPreimage = "preimage",
feePaidMsat = 10uL,
),
)
advanceUntilIdle()
verify(pendingPaymentRepo).resolve(PendingPaymentResolution.Success(paymentHash))
verify(activityRepo).setContact(contactPublicKey = contactKey, forPaymentId = paymentHash)
}
@Test
fun `pending contact lightning failure clears context`() = test {
val paymentHash = "pending_hash"
whenever(pendingPaymentRepo.isPending(paymentHash)).thenReturn(true)
whenever(pendingPaymentRepo.isActive(paymentHash)).thenReturn(false)
advanceUntilIdle()
setPendingContactPaymentContext(paymentHash, "pubkycontact")
nodeEvents.emit(
Event.PaymentFailed(
paymentId = "payment_id",
paymentHash = paymentHash,
reason = null,
),
)
advanceUntilIdle()
verify(pendingPaymentRepo).resolve(PendingPaymentResolution.Failure(paymentHash))
assertNull(pendingContactPaymentContext(paymentHash))
}
@Test
fun `preserveContactPaymentContext moves active context to pending`() = test {
val paymentHash = "pending_hash"
val contactKey = "pubkycontact"
setActiveContactPaymentContext(contactKey)
sut.preserveContactPaymentContext(paymentHash)
assertNull(activeContactPaymentContext())
assertEquals(contactKey, pendingContactPaymentContext(paymentHash)?.publicKey)
}
@Test
fun `lightning scan uses QuickPay when enabled`() = test {
val bolt11 = "lnbcrt1quickpay"
enableQuickPay(thresholdSats = 1000u)
stubLightningScan(bolt11 = bolt11, amountSats = 500u)
sut.onScanResult(bolt11)
advanceUntilIdle()
assertEquals(QuickPayData.Bolt11(sats = 500u, bolt11 = bolt11), sut.quickPayData.value)
assertEquals(Sheet.Send(SendRoute.QuickPay), sut.currentSheet.value)
}
@Test
fun `contact lightning payment skips QuickPay and opens confirm`() = test {
val bolt11 = "lnbcrt1contact"
enableQuickPay(thresholdSats = 1000u)
stubLightningScan(bolt11 = bolt11, amountSats = 500u)
sut.openContactPayment(paymentRequest = bolt11, publicKey = "pubkycontact")
advanceUntilIdle()
assertNull(sut.quickPayData.value)
assertEquals(Sheet.Send(SendRoute.Confirm), sut.currentSheet.value)
}
@Test
fun `channel ready refreshes public Paykit endpoints when sharing enabled`() = test {
enablePublicPaykitSharing()
advanceUntilIdle()
clearInvocations(publicPaykitRepo)
nodeEvents.emit(
Event.ChannelReady(
channelId = "testChannelId",
userChannelId = "testUserChannelId",
counterpartyNodeId = null,
fundingTxo = null,
),
)
advanceUntilIdle()
verify(publicPaykitRepo).syncCurrentPublishedEndpoints()
}
@Test
fun `channel closed refreshes public Paykit endpoints when sharing enabled`() = test {
enablePublicPaykitSharing()
advanceUntilIdle()
clearInvocations(publicPaykitRepo)
nodeEvents.emit(
Event.ChannelClosed(
channelId = "testChannelId",
userChannelId = "testUserChannelId",
counterpartyNodeId = null,
reason = null,
),
)
advanceUntilIdle()
verify(publicPaykitRepo).syncCurrentPublishedEndpoints()
}
@Test
fun `amount change clears confirmedWarnings`() = test {
setUnifiedState(amount = 1000u)
sut.setSendEvent(SendEvent.ConfirmAmountWarning(SanityWarning.VALUE_OVER_100_USD))
advanceUntilIdle()
assertTrue(sut.sendUiState.value.confirmedWarnings.isNotEmpty())
sut.setSendEvent(SendEvent.AmountChange(2000u))
advanceUntilIdle()
assertTrue(sut.sendUiState.value.confirmedWarnings.isEmpty())
}
@Test
fun `refreshFeeEstimates preserves lightning fee when payMethod is LIGHTNING`() = test {
val lightningFee = SendFee.Lightning(42)
setUnifiedState(amount = 1000u, payMethod = SendMethod.LIGHTNING, fee = lightningFee)
advanceUntilIdle()
sut.setSendEvent(SendEvent.SpeedAndFee)
advanceUntilIdle()
val currentFee = sut.sendUiState.value.fee
assertEquals(lightningFee, currentFee)
}
@Test
fun `lastLightningFee persists after switching to onchain`() = test {
balanceState.value = BalanceState(
maxSendOnchainSats = 100_000u,
maxSendLightningSats = 100_000u,
)
setUnifiedState(
amount = 1000u,
payMethod = SendMethod.LIGHTNING,
fee = SendFee.Lightning(42),
lastLightningFee = 42L,
)
advanceUntilIdle()
sut.setTransactionSpeed(TransactionSpeed.Medium)
advanceUntilIdle()
assertEquals(SendMethod.ONCHAIN, sut.sendUiState.value.payMethod)
assertEquals(42L, sut.sendUiState.value.lastLightningFee)
}
@Test
fun `lastLightningFee is zero initially`() = test {
assertEquals(0L, sut.sendUiState.value.lastLightningFee)
}
private fun enableQuickPay(thresholdSats: ULong) {
settingsData.value = SettingsData(isQuickPayEnabled = true, quickPayAmount = 5)
whenever(currencyRepo.convertFiatToSats(5.0, "USD")).thenReturn(Result.success(thresholdSats))
}
private suspend fun stubLightningScan(bolt11: String, amountSats: ULong) {
whenever(coreService.decode(bolt11)).thenReturn(Scanner.Lightning(lightningInvoice(bolt11, amountSats)))
whenever(lightningRepo.canSend(amountSats)).thenReturn(true)
}
private fun lightningInvoice(bolt11: String, amountSats: ULong) = LightningInvoice(
bolt11 = bolt11,
paymentHash = byteArrayOf(1, 2, 3),
amountSatoshis = amountSats,
timestampSeconds = 0u,
expirySeconds = 86_400u,
isExpired = false,
description = "",
networkType = NetworkType.REGTEST,
payeeNodeId = null,
)
private suspend fun enablePublicPaykitSharing() {
settingsData.value = SettingsData(sharesPublicPaykitEndpoints = true)
walletState.value = WalletState(onchainAddress = "bc1qtest")
whenever { publicPaykitRepo.syncCurrentPublishedEndpoints() }.thenReturn(Result.success(Unit))
}
@Suppress("UNCHECKED_CAST")
private fun setPendingContactPaymentContext(paymentHash: String, publicKey: String) {
val field = AppViewModel::class.java.getDeclaredField("pendingContactPaymentContexts")
field.isAccessible = true
val contexts = field.get(sut) as MutableMap<String, ContactPaymentContext>
contexts[paymentHash] = ContactPaymentContext(publicKey)
}
private fun setActiveContactPaymentContext(publicKey: String) {
val field = AppViewModel::class.java.getDeclaredField("activeContactPaymentContext")
field.isAccessible = true
field.set(sut, ContactPaymentContext(publicKey))
}
private fun activeContactPaymentContext(): ContactPaymentContext? {
val field = AppViewModel::class.java.getDeclaredField("activeContactPaymentContext")
field.isAccessible = true
return field.get(sut) as ContactPaymentContext?
}
@Suppress("UNCHECKED_CAST")
private fun pendingContactPaymentContext(paymentHash: String): ContactPaymentContext? {
val field = AppViewModel::class.java.getDeclaredField("pendingContactPaymentContexts")
field.isAccessible = true
val contexts = field.get(sut) as MutableMap<String, ContactPaymentContext>
return contexts[paymentHash]
}
@Suppress("UNCHECKED_CAST")
private fun setSendState(state: SendUiState) {
val field = AppViewModel::class.java.getDeclaredField("_sendUiState")
field.isAccessible = true
(field.get(sut) as MutableStateFlow<SendUiState>).value = state
}
private fun setUnifiedState(
amount: ULong = 0u,
payMethod: SendMethod = SendMethod.LIGHTNING,
fee: SendFee? = null,
lastLightningFee: Long = 0L,
) {
setSendState(
SendUiState(
address = "bcrt1qtest",
amount = amount,
isUnified = true,
payMethod = payMethod,
fee = fee,
lastLightningFee = lastLightningFee,
confirmedWarnings = persistentListOf(),
speed = TransactionSpeed.Medium,
)
)
// Trigger updateCanSwitchWallet via reflection
val method = AppViewModel::class.java.getDeclaredMethod("updateCanSwitchWallet")
method.isAccessible = true
method.invoke(sut)
}
}