get available local balance

This commit is contained in:
Carsten Otto
2021-11-12 17:35:05 +01:00
parent def458ebbb
commit a746dfd664
11 changed files with 204 additions and 18 deletions

View File

@@ -1,6 +1,7 @@
package de.cotto.lndmanagej.controller;
import de.cotto.lndmanagej.model.Coins;
import de.cotto.lndmanagej.service.BalanceService;
import de.cotto.lndmanagej.service.ChannelService;
import de.cotto.lndmanagej.service.FeeService;
import de.cotto.lndmanagej.service.NodeService;
@@ -51,6 +52,9 @@ class LegacyControllerIT {
@MockBean
private FeeService feeService;
@MockBean
private BalanceService balanceService;
@Test
void getAlias() throws Exception {
when(nodeService.getAlias(PUBKEY)).thenReturn(ALIAS);
@@ -136,4 +140,12 @@ class LegacyControllerIT {
mockMvc.perform(get(CHANNEL_BASE + "/outgoing-base-fee"))
.andExpect(content().string(String.valueOf(BASE_FEE.milliSatoshis())));
}
@Test
void getAvailableLocalBalance() throws Exception {
Coins availableBalance = Coins.ofSatoshis(999);
when(balanceService.getAvailableLocalBalance(CHANNEL_ID)).thenReturn(availableBalance);
mockMvc.perform(get(CHANNEL_BASE + "/available-local-balance"))
.andExpect(content().string(String.valueOf(availableBalance.satoshis())));
}
}