create failing test aggregate_zap_amount_group_by_user

This commit is contained in:
Chemaclass 2023-03-05 23:30:24 +01:00
parent 53e520ee8a
commit 6aa7c229b0

View File

@ -42,6 +42,29 @@ class UserZapsTest {
)
}
@Test
fun aggregate_zap_amount_group_by_user() {
val zaps: Map<Note, Note?> = mapOf(
mockk<Note>() to mockZapNoteWith("user-1", amount = 100),
mockk<Note>() to mockZapNoteWith("user-1", amount = 200),
mockk<Note>() to mockZapNoteWith("user-2", amount = 400),
)
val actual = UserZaps.groupByUser(zaps)
Assert.assertEquals(2, actual.count())
Assert.assertEquals(
BigDecimal(300),
(actual[0].second.event as LnZapEventInterface).amount()
)
Assert.assertEquals(
BigDecimal(400),
(actual[1].second.event as LnZapEventInterface).amount()
)
}
private fun mockZapNoteWith(pubkey: HexKey, amount: Int): Note {
val lnZapEvent = mockk<LnZapEventInterface>()