nshathish
nshathish

Reputation: 425

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

Upvotes: 0

Views: 1914

Answers (2)

dimaslz
dimaslz

Reputation: 525

I don't know if can help you but I had the same issue testing effects and I fixed it using https://ngrx.io/guide/effects/testing#with-testscheduler. I think the last versions of jasmine-marbles are not aligned with rxjs.

I hope could be helpful for you.

Upvotes: 1

user2144132
user2144132

Reputation: 98

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

Upvotes: 6

Related Questions