add endpoint: get all channels for peer

This commit is contained in:
Carsten Otto
2021-11-27 17:35:54 +01:00
parent 280804587e
commit e61cfa6ee2
3 changed files with 31 additions and 0 deletions

View File

@@ -141,6 +141,21 @@ class NodeControllerTest {
.isEqualTo(new ChannelsForNodeDto(PUBKEY, List.of(CHANNEL_ID, CHANNEL_ID_2)));
}
@Test
void getAllChannelIds() {
when(channelService.getAllChannelsWith(PUBKEY)).thenReturn(Set.of(LOCAL_OPEN_CHANNEL, CLOSED_CHANNEL_3));
assertThat(nodeController.getAllChannelIdsForPubkey(PUBKEY))
.isEqualTo(new ChannelsForNodeDto(PUBKEY, List.of(CHANNEL_ID, CHANNEL_ID_3)));
verify(metrics).mark(argThat(name -> name.endsWith(".getAllChannelIdsForPubkey")));
}
@Test
void getAllChannelIds_ordered() {
when(channelService.getAllChannelsWith(PUBKEY)).thenReturn(Set.of(CLOSED_CHANNEL_2, LOCAL_OPEN_CHANNEL));
assertThat(nodeController.getAllChannelIdsForPubkey(PUBKEY))
.isEqualTo(new ChannelsForNodeDto(PUBKEY, List.of(CHANNEL_ID, CHANNEL_ID_2)));
}
@Test
void getBalance() {
when(balanceService.getBalanceInformation(PUBKEY)).thenReturn(BALANCE_INFORMATION);