Wait for head for the full response (#523)
This commit is contained in:
@@ -63,7 +63,7 @@ class SubscribeChainStatusTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `first full event if there is already an ms head`() {
|
||||
fun `first full event if there is already a ms head`() {
|
||||
val head = mock<Head> {
|
||||
on { getCurrent() } doReturn head(550)
|
||||
on { getFlux() } doReturn Flux.empty()
|
||||
@@ -106,6 +106,29 @@ class SubscribeChainStatusTest {
|
||||
.verify(Duration.ofSeconds(1))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `first full event with awaiting a head from polling`() {
|
||||
val head = mock<Head> {
|
||||
on { getCurrent() } doReturn null doReturn head(550)
|
||||
on { getFlux() } doReturn Flux.empty()
|
||||
}
|
||||
val ms = spy<TestMultistream> {
|
||||
on { getHead() } doReturn head
|
||||
on { stateEvents() } doReturn Flux.empty()
|
||||
}
|
||||
val msHolder = mock<MultistreamHolder> {
|
||||
on { all() } doReturn listOf(ms)
|
||||
}
|
||||
val subscribeChainStatus = SubscribeChainStatus(msHolder, chainEventMapper)
|
||||
|
||||
StepVerifier.withVirtualTime { subscribeChainStatus.chainStatuses() }
|
||||
.expectSubscription()
|
||||
.expectNoEvent(Duration.ofSeconds(3))
|
||||
.expectNext(response(true))
|
||||
.thenCancel()
|
||||
.verify(Duration.ofSeconds(1))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `first full event with awaiting a head from a head stream and then state events`() {
|
||||
val head = mock<Head> {
|
||||
|
||||
Reference in New Issue
Block a user