NetanelBasal
4/22/2017 - 8:10 PM

et9.ts

  it('should return a GET_POSTS_FAIL action, on error, after the de-bounce', fakeAsync(() => {
    let resultFromEffect = null;
    const expectedResult = getPostsFail('error');

    postsService.get.and.returnValue(Observable.throw('error'));
    
    runner.queue(getPosts());

    postsEffects.get$.subscribe(resultFromEffect => result = resultFromEffect);
    
    tick(399);
    expect(result).toEqual(null);
    
    tick(400);
    expect(result).toEqual(expectedResult);

  }));