-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove inline functions from RxAction. (#359)
- Loading branch information
Showing
3 changed files
with
52 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
formula/src/test/java/com/instacart/formula/rxjava3/RxJavaRuntimeTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.instacart.formula.rxjava3 | ||
|
||
import com.instacart.formula.RuntimeConfig | ||
import com.instacart.formula.test.CountingInspector | ||
import com.instacart.formula.types.InputIdentityFormula | ||
import io.reactivex.rxjava3.core.Observable | ||
import org.junit.Test | ||
|
||
class RxJavaRuntimeTest { | ||
|
||
@Test fun `toObservable with unit input and no config`() { | ||
val formula = InputIdentityFormula<Unit>() | ||
formula.toObservable().test().assertValues(Unit) | ||
} | ||
|
||
@Test fun `toObservable with unit input and config`() { | ||
val inspector = CountingInspector() | ||
val config = RuntimeConfig(inspector = inspector) | ||
val formula = InputIdentityFormula<Unit>() | ||
formula.toObservable(config).test().assertValues(Unit) | ||
inspector.assertEvaluationCount(1) | ||
} | ||
|
||
@Test fun `toObservable with integer input and no config`() { | ||
val formula = InputIdentityFormula<Int>() | ||
formula.toObservable(0).test().assertValues(0) | ||
} | ||
|
||
@Test fun `toObservable with observable input and no config`() { | ||
val formula = InputIdentityFormula<Int>() | ||
formula.toObservable(Observable.just(0, 1, 2)).test().assertValues(0, 1, 2) | ||
} | ||
} |