add fee-configuration endpoint for channel

This commit is contained in:
Carsten Otto
2021-11-24 12:40:40 +01:00
parent 7ac9230adc
commit 30aae170fe
5 changed files with 54 additions and 14 deletions

View File

@@ -20,6 +20,7 @@ import static de.cotto.lndmanagej.model.ChannelFixtures.CAPACITY;
import static de.cotto.lndmanagej.model.ChannelIdFixtures.CHANNEL_ID;
import static de.cotto.lndmanagej.model.ChannelPointFixtures.CHANNEL_POINT;
import static de.cotto.lndmanagej.model.FeeConfigurationFixtures.FEE_CONFIGURATION;
import static de.cotto.lndmanagej.model.LocalOpenChannelFixtures.LOCAL_OPEN_CHANNEL;
import static de.cotto.lndmanagej.model.LocalOpenChannelFixtures.LOCAL_OPEN_CHANNEL_PRIVATE;
import static de.cotto.lndmanagej.model.NodeFixtures.ALIAS_2;
import static de.cotto.lndmanagej.model.PubkeyFixtures.PUBKEY_2;
@@ -102,4 +103,15 @@ class ChannelControllerIT {
mockMvc.perform(get(CHANNEL_PREFIX + "/details"))
.andExpect(status().isNotFound());
}
@Test
void getFeeConfiguration() throws Exception {
when(channelService.getLocalChannel(CHANNEL_ID)).thenReturn(Optional.of(LOCAL_OPEN_CHANNEL));
when(feeService.getFeeConfiguration(CHANNEL_ID)).thenReturn(FEE_CONFIGURATION);
mockMvc.perform(get(CHANNEL_PREFIX + "/fee-configuration"))
.andExpect(jsonPath("$.outgoingFeeRatePpm", is(1)))
.andExpect(jsonPath("$.outgoingBaseFeeMilliSat", is(2)))
.andExpect(jsonPath("$.incomingFeeRatePpm", is(3)))
.andExpect(jsonPath("$.incomingBaseFeeMilliSat", is(4)));
}
}