mirror of
https://github.com/aljazceru/lnd-manageJ.git
synced 2026-01-24 00:14:25 +01:00
add /balance endpoint for nodes
This commit is contained in:
@@ -98,7 +98,7 @@ class NodeControllerIT {
|
||||
}
|
||||
|
||||
@Test
|
||||
void getOpenChannelIds_for_peer() throws Exception {
|
||||
void getOpenChannelIds() throws Exception {
|
||||
when(channelService.getOpenChannelsWith(PUBKEY_2)).thenReturn(Set.of(LOCAL_OPEN_CHANNEL, LOCAL_OPEN_CHANNEL_3));
|
||||
List<String> channelIds = List.of(CHANNEL_ID.toString(), CHANNEL_ID_3.toString());
|
||||
mockMvc.perform(get(NODE_PREFIX + "/open-channels"))
|
||||
@@ -106,4 +106,16 @@ class NodeControllerIT {
|
||||
.andExpect(jsonPath("$.channels", is(channelIds)));
|
||||
}
|
||||
|
||||
@Test
|
||||
void getBalance() throws Exception {
|
||||
when(balanceService.getBalanceInformation(PUBKEY_2)).thenReturn(BALANCE_INFORMATION);
|
||||
mockMvc.perform(get(NODE_PREFIX + "/balance"))
|
||||
.andExpect(jsonPath("$.localBalance", is("1000")))
|
||||
.andExpect(jsonPath("$.localReserve", is("100")))
|
||||
.andExpect(jsonPath("$.localAvailable", is("900")))
|
||||
.andExpect(jsonPath("$.remoteBalance", is("123")))
|
||||
.andExpect(jsonPath("$.remoteReserve", is("10")))
|
||||
.andExpect(jsonPath("$.remoteAvailable", is("113")));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user