Skip to content

Commit

Permalink
root: Update dependency com.badoo.reaktive:reaktive to v2
Browse files Browse the repository at this point in the history
  • Loading branch information
MrHadiSatrio committed Nov 14, 2023
1 parent be755dc commit 8ce1950
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ object Dependencies {
}

object Asynchrony {
const val REACTIVE_EXTENSIONS = "com.badoo.reaktive:reaktive:1.3.0"
const val REACTIVE_EXTENSIONS_COROUTINE_INTEROP = "com.badoo.reaktive:coroutines-interop:1.3.0"
const val REACTIVE_EXTENSIONS = "com.badoo.reaktive:reaktive:2.0.0"
const val REACTIVE_EXTENSIONS_COROUTINE_INTEROP = "com.badoo.reaktive:coroutines-interop:2.0.0"
}

object Commons {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,22 @@ import com.badoo.reaktive.observable.Observable
import com.badoo.reaktive.observable.debounce
import com.badoo.reaktive.scheduler.Scheduler
import com.badoo.reaktive.scheduler.computationScheduler
import kotlin.time.Duration
import kotlin.time.Duration.Companion.milliseconds

class DebouncingEventSource(
private val timeoutMillis: Long,
private val timeoutMillis: Duration,
private val scheduler: Scheduler,
private val origin: EventSource
) : EventSource {

constructor(origin: EventSource) : this(DEFAULT_TIMEOUT_MILLIS, computationScheduler, origin)
constructor(origin: EventSource) : this(DEFAULT_TIMEOUT, computationScheduler, origin)

override fun events(): Observable<Event> {
return origin.events().debounce(timeoutMillis, scheduler)
}

companion object {
private const val DEFAULT_TIMEOUT_MILLIS = 300L
private val DEFAULT_TIMEOUT = 300L.milliseconds
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,16 @@ import io.mockk.every
import io.mockk.mockk
import io.mockk.verify
import kotlin.test.Test
import kotlin.time.Duration.Companion.milliseconds

class DebouncingEventSourceTest {

@Test
fun `Debounces the given origin`() {
val timeoutMillis = 100L
val timeout = 100L.milliseconds
val scheduler = mockk<Scheduler>(relaxed = true)
val origin = mockk<EventSource>(relaxed = true)
val source = DebouncingEventSource(timeoutMillis, scheduler, origin)
val source = DebouncingEventSource(timeout, scheduler, origin)
every { origin.events() } returns PublishSubject()

source.events().subscribe { }
Expand Down

0 comments on commit 8ce1950

Please sign in to comment.