@@ -8,7 +8,6 @@ import org.junit.Test
88import org.lightningdevkit.ldknode.BalanceDetails
99import org.lightningdevkit.ldknode.ChannelDetails
1010import org.lightningdevkit.ldknode.Event
11- import org.lightningdevkit.ldknode.Network
1211import org.mockito.kotlin.any
1312import org.mockito.kotlin.doReturn
1413import org.mockito.kotlin.mock
@@ -62,7 +61,6 @@ class WalletRepoTest : BaseUnitTest() {
6261 settingsStore = settingsStore,
6362 addressChecker = addressChecker,
6463 lightningRepo = lightningRepo,
65- network = Network .REGTEST
6664 )
6765 }
6866
@@ -132,7 +130,6 @@ class WalletRepoTest : BaseUnitTest() {
132130 settingsStore = settingsStore,
133131 addressChecker = addressChecker,
134132 lightningRepo = lightningRepo,
135- network = Network .BITCOIN
136133 )
137134
138135 val result = nonRegtestRepo.wipeWallet()
@@ -169,23 +166,25 @@ class WalletRepoTest : BaseUnitTest() {
169166 fun `refreshBip21 should generate new address when current has transactions` () = test {
170167 whenever(sut.getOnchainAddress()).thenReturn(" bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq" )
171168 whenever(lightningRepo.newAddress()).thenReturn(Result .success(" newAddress" ))
172- whenever(addressChecker.getAddressInfo(any())).thenReturn(AddressInfo (
173- address = " bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq" ,
174- chain_stats = AddressStats (
175- funded_txo_count = 1 ,
176- funded_txo_sum = 2 ,
177- spent_txo_count = 1 ,
178- spent_txo_sum = 1 ,
179- tx_count = 5
180- ),
181- mempool_stats = AddressStats (
182- funded_txo_count = 1 ,
183- funded_txo_sum = 2 ,
184- spent_txo_count = 1 ,
185- spent_txo_sum = 1 ,
186- tx_count = 5
169+ whenever(addressChecker.getAddressInfo(any())).thenReturn(
170+ AddressInfo (
171+ address = " bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq" ,
172+ chain_stats = AddressStats (
173+ funded_txo_count = 1 ,
174+ funded_txo_sum = 2 ,
175+ spent_txo_count = 1 ,
176+ spent_txo_sum = 1 ,
177+ tx_count = 5
178+ ),
179+ mempool_stats = AddressStats (
180+ funded_txo_count = 1 ,
181+ funded_txo_sum = 2 ,
182+ spent_txo_count = 1 ,
183+ spent_txo_sum = 1 ,
184+ tx_count = 5
185+ )
187186 )
188- ))
187+ )
189188
190189 val result = sut.refreshBip21()
191190
@@ -197,23 +196,25 @@ class WalletRepoTest : BaseUnitTest() {
197196 fun `refreshBip21 should keep address when current has no transactions` () = test {
198197 val existingAddress = " bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq"
199198 whenever(sut.getOnchainAddress()).thenReturn(existingAddress)
200- whenever(addressChecker.getAddressInfo(any())).thenReturn(AddressInfo (
201- address = " bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq" ,
202- chain_stats = AddressStats (
203- funded_txo_count = 1 ,
204- funded_txo_sum = 2 ,
205- spent_txo_count = 1 ,
206- spent_txo_sum = 1 ,
207- tx_count = 0
208- ),
209- mempool_stats = AddressStats (
210- funded_txo_count = 1 ,
211- funded_txo_sum = 2 ,
212- spent_txo_count = 1 ,
213- spent_txo_sum = 1 ,
214- tx_count = 0
199+ whenever(addressChecker.getAddressInfo(any())).thenReturn(
200+ AddressInfo (
201+ address = " bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq" ,
202+ chain_stats = AddressStats (
203+ funded_txo_count = 1 ,
204+ funded_txo_sum = 2 ,
205+ spent_txo_count = 1 ,
206+ spent_txo_sum = 1 ,
207+ tx_count = 0
208+ ),
209+ mempool_stats = AddressStats (
210+ funded_txo_count = 1 ,
211+ funded_txo_sum = 2 ,
212+ spent_txo_count = 1 ,
213+ spent_txo_sum = 1 ,
214+ tx_count = 0
215+ )
215216 )
216- ))
217+ )
217218
218219 val result = sut.refreshBip21()
219220
@@ -278,7 +279,14 @@ class WalletRepoTest : BaseUnitTest() {
278279
279280 @Test
280281 fun `refreshBip21ForEvent should not refresh for other events` () = test {
281- sut.refreshBip21ForEvent(Event .PaymentSuccessful (paymentId = " " , paymentHash = " " , paymentPreimage = " " , feePaidMsat = 10uL ))
282+ sut.refreshBip21ForEvent(
283+ Event .PaymentSuccessful (
284+ paymentId = " " ,
285+ paymentHash = " " ,
286+ paymentPreimage = " " ,
287+ feePaidMsat = 10uL
288+ )
289+ )
282290
283291 verify(lightningRepo, never()).newAddress()
284292 }
0 commit comments