Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ngrx 4 testing effects jasmine-marbles

I am working on testing effects in ngrx store. And after updating ngrx to version I've found that the way, how to test it, has been changed.

import { hot, cold } from 'jasmine-marbles';

it('should work', () => {
   actions = hot('--a-', { a: SomeAction });

   const expected = cold('--b', { b: AnotherAction });

   expect(effects.someSource$).toBeObservable(expected);
});  

Unfortunately I didn't find any documentations for jasmine-marbles. Could anybody explain what mean the first parameter for hot an cold functions? And is it possible to find any documentation about it?

like image 375
ilyabasiuk Avatar asked Jul 28 '17 10:07

ilyabasiuk


People also ask

What is the marble test?

What is marble testing? Marble testing allows you to test asynchronous RxJS code synchronously and step-by-step with the help of RxJS TestScheduler test utility and using virtual time steps. There are also marble diagrams which demonstrate what is happening with a particular operation in the observable stream.

How effects are called in NgRx?

NgRx Effects are a popular part of NgRx, a state management library built for Angular. Effects are usually used to perform side effects like fetching data using HTTP, WebSockets, writing to browser storage, and more.


1 Answers

Finally found some documentation about it https://ngrx.io/guide/effects/testing#marble-diagrams

Probably it would be helpful to some one else.

like image 198
ilyabasiuk Avatar answered Oct 09 '22 11:10

ilyabasiuk