@@ -2,37 +2,27 @@ package com.instacart.formula.test
2
2
3
3
import com.instacart.formula.IFormula
4
4
import com.instacart.formula.Stream
5
- import io.reactivex.rxjava3.core.Observable
6
5
7
6
/* *
8
7
* An extension function to create a [TestFormulaObserver] for a [IFormula] instance.
9
8
*
10
- * @param input Input passed to [IFormula ].
9
+ * Note: Formula won't start until you pass it an [input][TestFormulaObserver.input ].
11
10
*/
12
- fun <Input : Any , Output : Any , F : IFormula <Input , Output >> F.test (
13
- input : Input
14
- ): TestFormulaObserver <Input , Output , F > {
15
- return test(Observable .just(input))
11
+ fun <Input : Any , Output : Any , F : IFormula <Input , Output >> F.test (): TestFormulaObserver <Input , Output , F > {
12
+ return TestFormulaObserver (this )
16
13
}
17
14
18
-
19
15
/* *
20
16
* An extension function to create a [TestFormulaObserver] for a [IFormula] instance.
21
17
*
22
- * @param input A stream of inputs passed to [IFormula].
18
+ * @param initialInput Input passed to [IFormula].
23
19
*/
24
20
fun <Input : Any , Output : Any , F : IFormula <Input , Output >> F.test (
25
- input : Observable < Input >
21
+ initialInput : Input
26
22
): TestFormulaObserver <Input , Output , F > {
27
- return TestFormulaObserver (
28
- input = input,
29
- formula = this
30
- )
23
+ return test().apply {
24
+ input(initialInput)
25
+ }
31
26
}
32
27
33
- /* *
34
- * An extension function to create a [TestFormulaObserver] for a [IFormula] instance.
35
- */
36
- fun <Output : Any , F : IFormula <Unit , Output >> F.test () = test(Unit )
37
-
38
28
fun <Message > Stream<Message>.test () = TestStreamObserver (this )
0 commit comments