Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions .githooks/commit-msg

This file was deleted.

17 changes: 0 additions & 17 deletions .githooks/pre-push

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.anytypeio.anytype.feature_chats

import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.StandardTestDispatcher
import kotlinx.coroutines.test.TestDispatcher
import kotlinx.coroutines.test.resetMain
import kotlinx.coroutines.test.setMain
import org.junit.rules.TestWatcher
import org.junit.runner.Description

@ExperimentalCoroutinesApi
class DefaultCoroutineTestRule(
val dispatcher: TestDispatcher = StandardTestDispatcher()
) : TestWatcher() {
override fun starting(description: Description) {
Dispatchers.setMain(dispatcher)
}

override fun finished(description: Description) {
Dispatchers.resetMain()
}

fun advanceTime(millis: Long = 100L) {
dispatcher.scheduler.advanceTimeBy(millis)
}

fun advanceUntilIdle() = dispatcher.scheduler.advanceUntilIdle()

}
Loading