RubyLichtenstein / RxTest

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

Writing marble tests #17

Open jmfayard opened 6 years ago

jmfayard commented 6 years ago

Hello, what I lack when testing rx java things is the ability to quickly produce input observables.

RxJs has super cool functions to produce those

cold("--a--b--#"): On frame 20 emit a, on frame 50 emit b, and on frame 80, error`

hot("-a-^-b--|"): In a hot observable, on frame -20 emit a, then on frame 20 emit b, and on frame 50, complete.

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

something like that in kotlin would be super valuable

RubyLichtenstein commented 6 years ago

Looks interesting, thank you.

RubyLichtenstein commented 6 years ago

Hi @jmfayard

Do you want to work on this feature?

jmfayard commented 6 years ago

@RubyLichtenstein I can contribute what I already did. I fear I don't understand enough rxjava to make it right by myself though

RubyLichtenstein commented 6 years ago

Great, so please fork the project and add what you all ready done

What about porting the JavaScript code to kotlin code?

jmfayard commented 6 years ago

We should steal their ideas, not their code. A lot of how it's implemented rely on how javascript works. e.g you don't have dynamic types on the JVM.

RubyLichtenstein commented 6 years ago

I think we should take what we can from the js code. We shouldn't do work that already done Its not stealing if its open source :)

RubyLichtenstein commented 6 years ago

https://github.com/ReactiveX/rxjs/blob/master/src/internal/testing/TestScheduler.ts

RubyLichtenstein commented 6 years ago

Most of the code should be the same

jmfayard commented 6 years ago

I meant stealing in a positive sense, like T.S. Eliott quote Good artists copy; great artists steal.

jmfayard commented 6 years ago

https://github.com/RubyLichtenstein/RxTest/pull/19

RubyLichtenstein commented 6 years ago

Great job!

I'll review it as soon as I have time

RubyLichtenstein commented 6 years ago

So the work you did is not based on the js implementation?

jmfayard commented 6 years ago

no, I didn't have the code of the js implementation at that time.