allow queries for channel ID in all supported formats

This commit is contained in:
Carsten Otto
2022-05-10 19:58:17 +02:00
committed by Carsten Otto
parent aa51837cd6
commit 0c69d9f9b2
2 changed files with 23 additions and 8 deletions

View File

@@ -19,8 +19,10 @@ import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import static de.cotto.lndmanagej.model.ChannelIdFixtures.CHANNEL_ID;
import static de.cotto.lndmanagej.model.ChannelPointFixtures.CHANNEL_POINT;
import static de.cotto.lndmanagej.ui.model.ChannelDetailsDtoFixture.CHANNEL_DETAILS_DTO;
import static de.cotto.lndmanagej.ui.model.NodeDetailsDtoFixture.NODE_DETAILS_DTO;
import static de.cotto.lndmanagej.ui.model.OpenChannelDtoFixture.OPEN_CHANNEL_DTO;
@@ -68,6 +70,12 @@ class SearchControllerIT {
searchForChannelId(CHANNEL_ID);
}
@Test
void searchForChannelId_viaChannelPoint_found() throws Exception {
when(channelIdResolver.resolveFromChannelPoint(CHANNEL_POINT)).thenReturn(Optional.of(CHANNEL_ID));
searchForChannelId(CHANNEL_POINT.toString());
}
private void searchForChannelId(Object query) throws Exception {
when(dataService.getOpenChannels()).thenReturn(
List.of(openChannelDto(CHANNEL_DETAILS_DTO))