Add additional call links moderation ui.

This commit is contained in:
Alex Hart
2023-08-08 15:10:47 -03:00
parent 7c209db146
commit 30d0b6fd0e
20 changed files with 531 additions and 105 deletions

View File

@@ -164,7 +164,8 @@ class PendingParticipantCollectionTest {
val expected = PendingParticipantCollection.Entry(
recipient = recipients[0],
state = PendingParticipantCollection.State.DENIED,
stateChangeAt = 1.milliseconds
stateChangeAt = 1.milliseconds,
denialCount = 1
)
val actual = subject.getAllPendingParticipants(0.milliseconds).first()
@@ -225,6 +226,45 @@ class PendingParticipantCollectionTest {
assertEquals(expected, actual)
}
@Test
fun `Given a participant is denied once, when I withRecipients, then I expect the state to be changed to PENDING`() {
val recipients = createRecipients(1)
val expected = PendingParticipantCollection.Entry(
recipient = recipients[0],
state = PendingParticipantCollection.State.PENDING,
stateChangeAt = 2.milliseconds,
denialCount = 1
)
val actual = testSubject
.withRecipients(recipients)
.withDenial(recipients[0])
.withRecipients(recipients)
.getAllPendingParticipants(0.milliseconds)
assertEquals(expected, actual.first())
}
@Test
fun `Given a participant is denied twice, when I withRecipients, then I expect the state to be DENIED`() {
val recipients = createRecipients(1)
val expected = PendingParticipantCollection.Entry(
recipient = recipients[0],
state = PendingParticipantCollection.State.DENIED,
stateChangeAt = 2.milliseconds,
denialCount = 2
)
val actual = testSubject
.withRecipients(recipients)
.withDenial(recipients[0])
.withDenial(recipients[0])
.withRecipients(recipients)
.getAllPendingParticipants(0.milliseconds)
assertEquals(expected, actual.first())
}
private fun createRecipients(count: Int): List<Recipient> {
return (1..count).map { RecipientDatabaseTestUtils.createRecipient() }
}