Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

201
Vistas
unit test angular ngrx component

I'm trying to test a unit test for a component into angular, into the component I have a filterTypeahead function that expect a string, this value is inserted into a Subject, when it happen I have other code for dispatch a loadData, so with filteredData$ observable I subscribe to it for get the data

it('should not get the data if there are no input value', fakeAsync(async () => {
    component.ngAfterViewInit();
    component.filterTypeahead({ value: '' });
    tick(500);
    
    component.filteredData$.subscribe((value: any[]) => {
      expect(value).toEqual([]);
    });
  }));

But I don't know why I'm getting the flollow error

TypeError: Cannot read properties of undefined (reading 'data') on selectors

  let component: WidgetComponent;
  let fixture: ComponentFixture<WidgetComponent>;
  let store: MockStore;

  const initialState = {
    data: []
  };


beforeEach((() => {
    TestBed.configureTestingModule({
      declarations: [WidgetComponent],
      schemas: [NO_ERRORS_SCHEMA],
      providers: [
        provideMockStore({ initialState })
      ],
    }).compileComponents();

    store = TestBed.inject(MockStore);
    spyOn(store, 'dispatch');
  }));

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda