RubyLichtenstein / RxTest

Kotlin DSL for easier RxJava testing.
Apache License 2.0
282 stars 11 forks source link

Add prototype for producing an Observable with a marble diagram #19

Closed jmfayard closed 5 years ago

jmfayard commented 6 years ago
val o: Observable<String> = rxmarble(
     "--1---3-|", scheduler, tick,
     listOf("2", "4", "9")
)

The marble diagram describes when things are emitted, the list is a mapping that describes what is emitted for a given index (starting at 1). If you use a mapping of type List<T> you get an Observable<T>. Alternatively you can pass a lambda.

In this case, the observable

wait 30 ms, produce "2" (first element of the list) wait 45ms, produce "9" (third element of the list), wait 15ms, complete

Inspired by https://github.com/ReactiveX/rxjs/blob/master/doc/writing-marble-tests.md

API: instable Bugs: a lot Missing features: a lot