Skip to content

Instantly share code, notes, and snippets.

@KwabenBerko
Created July 18, 2023 22:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KwabenBerko/a9576174859ba23394c0a7f96e12075e to your computer and use it in GitHub Desktop.
Save KwabenBerko/a9576174859ba23394c0a7f96e12075e to your computer and use it in GitHub Desktop.
Job Status Component Test
@OptIn(ExperimentalCoroutinesApi::class)
class JobStatusComponentTest {
@Test
fun `should call refresh function only once`() = runTest {
val jobs = mutableListOf<Job>()
val component = JobStatusComponent(scope = this)
repeat(10){
jobs += launch { component.refresh() }
}
jobs.joinAll()
assertEquals(1, component.refreshesCount)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment