Last active
June 22, 2022 08:51
-
-
Save micHar/0d5553ea25105ac6c8e34eeec03587ba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
fun `should change state to Playing after play() called`() = runTest(UnconfinedTestDispatcher()) { | |
val soundPlayer = mockk<SoundPlayer>() | |
coJustRun { soundPlayer.playSound() } | |
val sut = MediaPlayer(this, soundPlayer) | |
sut.playerState.test { | |
awaitItem() shouldBe PlayerState.Stopped | |
sut.play() | |
awaitItem() shouldBe PlayerState.Playing | |
cancelAndIgnoreRemainingEvents() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment