Skip to content

Commit

Permalink
Update channel tests - takeComplete()
Browse files Browse the repository at this point in the history
  • Loading branch information
hishamMuneer authored Aug 1, 2024
1 parent 4375456 commit e1079b9
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/commonTest/kotlin/app/cash/turbine/ChannelTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,19 @@ class ChannelTest {
assertEquals("Expected item but found Error(CustomThrowable)", actual.message)
assertSame(error, actual.cause)
}

@Test fun takeComplete() = withTestScope {
val channel = channelOf("item!")
channel.takeItem()
channel.takeComplete()
}

@Test fun takeCompleteFailsForItem() = withTestScope {
val channel = channelOf("item!")
assertFailsWith<AssertionError> {
channel.takeComplete()
}
}

@Test
fun expectMostRecentItemButNoItemWasFoundThrowsWithName() = runTest {
Expand Down

0 comments on commit e1079b9

Please sign in to comment.