I would I go about to unit test this function? ``...
# testing
I would I go about to unit test this function?
Copy code
fun createCoroutineScope(): CoroutineScope = CoroutineScope(SupervisorJob() + Dispatchers.Default)
So in my test I have to check if the returned
is using a
or a particular
how do I do that?? (or any other property of the context/scope) For instance, say I wanna write an unit test that force me to create a
Copy code
fun createCoroutineScope_produce_a_supervisor_job() {
  val scope = createCoroutineScope()
  val job = scope.coroutineContext[Job]
  assertTrue(job is SupervisorJob) // can't do
is not an interface or a class, it's a top level function. It's implementation tells me nothing about what kind of job it is or how it handle children. The implementation is private. I cannot find a way to force me to write that code from an unit test, can anyone enlighten me? (I've asked this in #getting-started but I realized it is better suited here + I asked it better here)