mirror of
https://github.com/aljazceru/lnd-manageJ.git
synced 2026-01-22 15:35:10 +01:00
add endpoints: get all / all open channels
This commit is contained in:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user