jasmine-marbles next only emit first value

Discussão em 'Angular' iniciado por danday74, Janeiro 20, 2025.

  1. danday74

    danday74 Guest

    I've got some marbles like so:

    import { cold, getTestScheduler } from 'jasmine-marbles'
    const marbles$ = cold('--x--y|', {x: false, y: true})


    When I call:

    getTestScheduler().flush()


    Both x and y are emitted. However, I want to do this:

    it('my test', () => {
    // setup spies and other logic here
    const marbles$ = cold('--x--y|', {x: false, y: true})
    expect(foo).toBe(bar1)
    // EMIT x FROM marbles$ here
    expect(foo).toBe(bar2)
    // EMIT y FROM marbles$ here
    expect(foo).toBe(bar3)
    })


    Is this possible? If so how do I achieve this?

    What I am looking for is something like getTestScheduler().next() similar to how you would call next on an RxJs Subject. Maybe it would emit the next item in the marbles or it would emit nothing if the next item was '-'. I'm not exactly sure how it would work.

    Continue reading...

Compartilhe esta Página