Skip to content

doing a custom non-deep object comparison  #84

@pocketmax

Description

@pocketmax
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' 
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions