add /balance endpoint for channels

This commit is contained in:
Carsten Otto
2021-11-24 12:59:04 +01:00
parent 09a57923a5
commit da9518d711
3 changed files with 39 additions and 0 deletions

View File

@@ -104,6 +104,18 @@ class ChannelControllerIT {
.andExpect(status().isNotFound());
}
@Test
void getBalance() throws Exception {
when(balanceService.getBalanceInformation(CHANNEL_ID)).thenReturn(Optional.of(BALANCE_INFORMATION_2));
mockMvc.perform(get(CHANNEL_PREFIX + "/balance"))
.andExpect(jsonPath("$.localBalance", is("2000")))
.andExpect(jsonPath("$.localReserve", is("200")))
.andExpect(jsonPath("$.localAvailable", is("1800")))
.andExpect(jsonPath("$.remoteBalance", is("223")))
.andExpect(jsonPath("$.remoteReserve", is("20")))
.andExpect(jsonPath("$.remoteAvailable", is("203")));
}
@Test
void getFeeConfiguration() throws Exception {
when(channelService.getLocalChannel(CHANNEL_ID)).thenReturn(Optional.of(LOCAL_OPEN_CHANNEL));