выполняется, а иногда выдаёт такую ошибку:
                  
                  
                  TypeError: You provided 'undefined' where a stream was expected. You can provide an Observable, Promise, Array, or Iterable.
                  
                  
                  Тест имеет следующий вид:
                  
                  
                  it('should make expected calls', () => {
                  
                  
                    spyOn(component['someService'], 'someAction')
                  
                  
                    component.ngOnInit();
                  
                  
                    expect(component['someService'].someAction).toHaveBeenCalled();
                  
                  
                  });
                  
                  
                  Тестируемый код такой:
                  
                  
                  ngOnInit() {
                  
                  
                    this.store.value$
                  
                  
                    .pipe(
                  
                  
                      switchMap(value => this.someService.someAction(value)),
                  
                  
                    )
                  
                  
                    .subscribe(() => {});
                  
                  
                  }
                  
                  
                  
                  
                  
                  someAction(value): Observable<any> {
                  
                  
                    return this.http.get<any>(this.url, {params: value});
                  
                  
                  }
                  
                  
                  
                  
                  
                  Возникает закономерный вопрос: почему тест может так рандомно падать?
                  
                  
                
spyOn(...).and.callThrough();
Обсуждают сегодня