@@ -22,12 +22,14 @@ import org.mockito.kotlin.verify
2222import org.mockito.kotlin.verifyBlocking
2323import org.mockito.kotlin.whenever
2424import org.mockito.kotlin.wheneverBlocking
25+ import to.bitkit.data.AppCacheData
2526import to.bitkit.data.CacheStore
2627import to.bitkit.data.SettingsData
2728import to.bitkit.data.SettingsStore
2829import to.bitkit.data.dto.TransactionMetadata
2930import to.bitkit.data.keychain.Keychain
3031import to.bitkit.ext.createChannelDetails
32+ import to.bitkit.models.BalanceState
3133import to.bitkit.models.CoinSelectionPreference
3234import to.bitkit.models.ElectrumServer
3335import to.bitkit.models.LnPeer
@@ -286,8 +288,15 @@ class LightningRepoTest : BaseUnitTest() {
286288 }
287289
288290 @Test
289- fun `canSend should return false when node is not running` () = test {
290- assertFalse(sut.canSend(1000uL ))
291+ fun `canSend should use cached outbound when node is not running` () = test {
292+ val cacheData = AppCacheData (
293+ balance = BalanceState (
294+ maxSendLightningSats = 2000uL
295+ )
296+ )
297+ whenever(cacheStore.data).thenReturn(flowOf(cacheData))
298+
299+ assert (sut.canSend(1000uL , fallbackToCachedBalance = true ))
291300 }
292301
293302 @Test
0 commit comments