Search code examples
angularrxjsjasmine-marbles

unit testing using jasmine marbles


I am trying to do a simple test using jasmine-marbles but getting errors

This is my test code:

describe('MarbleTestingComponent', () => {
  it('should test marble syntax', () => {
    const provided = search('e');
    const expected = cold('(e|)', {e: 'e'});
    console.log(expected, provided);
    expect(provided).toBeObservable(expected);
  })   

});

and this is the error I am getting:

Error: 
            Expected: (e|),
            Received: (?|),
            
            Expected:
            [{"frame":0,"notification":{"kind":"N","value":"e","hasValue":true}},{"frame":0,"notification":{"kind":"C","hasValue":false}}]
            
            Received:
            [{"frame":0,"notification":{"kind":"N","value":"e"}},{"frame":0,"notification":{"kind":"C"}}],

if I use the jest framework, the above code works, but I want to get it working withe default test framework that comes with Angular setup

Any help to sort this error is appreciated Thanks


Solution

  • Try checking the jasmine-marbles version.

    I experienced the same issue with using "jasmine-marbles": "^0.9.0" with "rxjs": "^6.6.7".

    Downgrading to "jasmine-marbles": "^0.8.0" resolved the issue.

    See supported versions here: https://github.com/synapse-wireless-labs/jasmine-marbles#readme