mirror of
https://github.com/aljazceru/lnd-manageJ.git
synced 2026-01-22 07:24:23 +01:00
get channel IDs for channels with peer
This commit is contained in:
@@ -1,14 +1,17 @@
|
||||
package de.cotto.lndmanagej.controller;
|
||||
|
||||
import de.cotto.lndmanagej.grpc.GrpcNodeInfo;
|
||||
import de.cotto.lndmanagej.service.NodeService;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static de.cotto.lndmanagej.model.ChannelIdFixtures.CHANNEL_ID;
|
||||
import static de.cotto.lndmanagej.model.ChannelIdFixtures.CHANNEL_ID_3;
|
||||
import static de.cotto.lndmanagej.model.NodeFixtures.ALIAS;
|
||||
import static de.cotto.lndmanagej.model.NodeFixtures.NODE;
|
||||
import static de.cotto.lndmanagej.model.PubkeyFixtures.PUBKEY;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.Mockito.when;
|
||||
@@ -19,17 +22,20 @@ class NodeControllerTest {
|
||||
private NodeController nodeController;
|
||||
|
||||
@Mock
|
||||
private GrpcNodeInfo grpcNodeInfo;
|
||||
private NodeService nodeService;
|
||||
|
||||
@Test
|
||||
void getAlias() {
|
||||
when(grpcNodeInfo.getNode(PUBKEY)).thenReturn(NODE);
|
||||
when(nodeService.getAlias(PUBKEY)).thenReturn(ALIAS);
|
||||
assertThat(nodeController.getAlias(PUBKEY)).isEqualTo(ALIAS);
|
||||
}
|
||||
|
||||
@Test
|
||||
void getAlias_uppercase_pubkey() {
|
||||
when(grpcNodeInfo.getNode(PUBKEY)).thenReturn(NODE);
|
||||
assertThat(nodeController.getAlias(PUBKEY)).isEqualTo(ALIAS);
|
||||
void getOpenChannelIds() {
|
||||
when(nodeService.getOpenChannelIds(PUBKEY)).thenReturn(List.of(CHANNEL_ID, CHANNEL_ID_3));
|
||||
assertThat(nodeController.getOpenChannelIds(PUBKEY)).containsExactly(
|
||||
CHANNEL_ID.shortChannelId(),
|
||||
CHANNEL_ID_3.shortChannelId()
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user