https://kotlinlang.org logo
#mockk
Title
# mockk
d

dave08

10/29/2018, 2:31 PM
For:
Copy code
coIt("starts the downloading of files in parts") { scope ->
			val progress = 0L..100L step 50L
			val client = mockk<FileDownloadClient>().apply {
				every { scope.download(any(), any(), any()) } returns progress.asReceiveChannel()
			}
			....
			coVerify(exactly = 2) { with(client) { scope.download(url, any(), any()) } }
		}
With coIt (spek 1.x) defined as:
Copy code
fun TestContainer.coIt(description: String, body: suspend TestBody.(scope: CoroutineScope) -> Unit) =
	test("it $description", body = { runBlocking { body(this) } })