cartant / rxjs-marbles

An RxJS marble testing library for any test framework

Home Page:https://cartant.github.io/rxjs-marbles/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

doing a custom non-deep object comparison

pocketmax opened this issue · comments

it('bar',marbles(m =>{
    const vals = {
        a: {
            x: 10,
            y: 20,
            z: 30
        }
    }
    const stream = new Observable((sub)=>{
        sub.next({
            x: 11,
            h: false
        })
    })
    m.expect(stream).toBeObservable("a", vals)
}))

I don't want to a deep object compare between the emitted value and my test. I just want to test parts of the emitted value. In this case if x>=10. Is that possible with .toBeObservable? i.e.

m.expect(stream).toBeObservable("a", (vals)=>{
    if(vals['a']['x']<10) throw 'bad x' 
})