add endpoints: get all / all open channels

This commit is contained in:
Carsten Otto
2021-11-27 17:26:30 +01:00
parent df2bd929ee
commit 280804587e
4 changed files with 74 additions and 0 deletions

View File

@@ -53,6 +53,17 @@ class StatusControllerIT {
.andExpect(content().string("123456"));
}
@Test
void getOpenChannels() throws Exception {
when(channelService.getOpenChannels()).thenReturn(Set.of(LOCAL_OPEN_CHANNEL_TO_NODE_3, LOCAL_OPEN_CHANNEL));
List<String> sortedChannelIds = List.of(
LOCAL_OPEN_CHANNEL.getId().toString(),
LOCAL_OPEN_CHANNEL_TO_NODE_3.getId().toString()
);
mockMvc.perform(get(PREFIX + "/open-channels/"))
.andExpect(jsonPath("$.channels", is(sortedChannelIds)));
}
@Test
void getPubkeysForOpenChannels() throws Exception {
when(channelService.getOpenChannels()).thenReturn(Set.of(LOCAL_OPEN_CHANNEL_TO_NODE_3, LOCAL_OPEN_CHANNEL));
@@ -64,6 +75,17 @@ class StatusControllerIT {
.andExpect(jsonPath("$.pubkeys", is(sortedPubkeys)));
}
@Test
void getAllChannels() throws Exception {
when(channelService.getAllLocalChannels()).thenReturn(Stream.of(LOCAL_OPEN_CHANNEL_TO_NODE_3, CLOSED_CHANNEL));
List<String> sortedChannelIds = List.of(
CLOSED_CHANNEL.getId().toString(),
LOCAL_OPEN_CHANNEL_TO_NODE_3.getId().toString()
);
mockMvc.perform(get(PREFIX + "/all-channels/"))
.andExpect(jsonPath("$.channels", is(sortedChannelIds)));
}
@Test
void getPubkeysForAllChannels() throws Exception {
when(channelService.getAllLocalChannels()).thenReturn(Stream.of(LOCAL_OPEN_CHANNEL_TO_NODE_3, CLOSED_CHANNEL));