Skip to content

Commit

Permalink
lets try this
Browse files Browse the repository at this point in the history
  • Loading branch information
floschu committed May 9, 2021
1 parent a0faf3e commit a023cb2
Showing 1 changed file with 18 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,28 @@ internal class CreateControllerTest {

@Suppress("UNCHECKED_CAST")
@Test
fun `default parameters of controller builder`() = runBlockingTest {
val expectedInitialState = 42
val sut = createController<Int, Int, Int>(
initialState = expectedInitialState
) as ControllerImplementation<Int, Int, Int, Nothing>
fun `default parameters of controller builder`() {
runBlockingTest {
val expectedInitialState = 42
val sut = createController<Int, Int, Int>(
initialState = expectedInitialState
) as ControllerImplementation<Int, Int, Int, Nothing>

assertEquals(this, sut.scope)
assertEquals(expectedInitialState, sut.initialState)
assertEquals(this, sut.scope)
assertEquals(expectedInitialState, sut.initialState)

assertEquals(null, sut.mutator(mockk(), 3).singleOrNull())
assertEquals(1, sut.reducer(mockk(), 0, 1))
assertEquals(null, sut.mutator(mockk(), 3).singleOrNull())
assertEquals(1, sut.reducer(mockk(), 0, 1))

assertEquals(1, sut.actionsTransformer(mockk(), flowOf(1)).single())
assertEquals(2, sut.mutationsTransformer(mockk(), flowOf(2)).single())
assertEquals(3, sut.statesTransformer(mockk(), flowOf(3)).single())
assertEquals(1, sut.actionsTransformer(mockk(), flowOf(1)).single())
assertEquals(2, sut.mutationsTransformer(mockk(), flowOf(2)).single())
assertEquals(3, sut.statesTransformer(mockk(), flowOf(3)).single())

assertEquals(defaultTag(), sut.tag)
assertEquals(ControllerLog.default, sut.controllerLog)
assertEquals(defaultTag(), sut.tag)
assertEquals(ControllerLog.default, sut.controllerLog)

assertEquals(ControllerStart.Lazy, sut.controllerStart)
assertEquals(defaultScopeDispatcher(), sut.dispatcher)
assertEquals(ControllerStart.Lazy, sut.controllerStart)
assertEquals(defaultScopeDispatcher(), sut.dispatcher)
}
}
}

0 comments on commit a023cb2

Please sign in to comment.