mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2024-09-29 08:20:51 +00:00
create failing test aggregate_zap_amount_group_by_user
This commit is contained in:
parent
53e520ee8a
commit
6aa7c229b0
@ -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>()
|
||||
|
Loading…
Reference in New Issue
Block a user