diff --git a/src/app/search/containers/result.component.spec.ts b/src/app/search/containers/result.component.spec.ts index a140455e43ef63cd8586589f3f1cc5cc74345c55..54cb6594752c49405a28a98505195215ddc5280b 100644 --- a/src/app/search/containers/result.component.spec.ts +++ b/src/app/search/containers/result.component.spec.ts @@ -1,10 +1,11 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { ComponentFixture, TestBed, async } from '@angular/core/testing'; import { provideMockStore, MockStore } from '@ngrx/store/testing'; import { Component, Input } from '@angular/core'; import { ResultComponent } from './result.component'; import * as fromMetamodel from '../../metamodel/reducers'; import * as fromSearch from '../store/search.reducer'; +import * as datasetActions from '../../metamodel/action/dataset.action'; import * as searchActions from '../store/search.action'; import { Dataset, Attribute } from 'src/app/metamodel/model'; import { Criterion, SearchQueryParams } from '../store/model'; @@ -65,7 +66,7 @@ fdescribe('[Search] Container: ResultComponent', () => { metamodel: { ...fromMetamodel } }; - beforeEach(() => { + beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ ResultComponent, @@ -83,18 +84,20 @@ fdescribe('[Search] Container: ResultComponent', () => { fixture = TestBed.createComponent(ResultComponent); component = fixture.componentInstance; store = TestBed.inject(MockStore); - }); + })); it('should create the component', () => { expect(component).toBeTruthy(); }); it('should execute ngOnInit lifecycle', () => { - const action = new searchActions.ChangeStepAction('result'); + // const changeStepAction = new searchActions.ChangeStepAction('result'); + const loadDatasetSearchMetaAction = new datasetActions.LoadDatasetSearchMetaAction(); const spy = spyOn(store, 'dispatch'); fixture.detectChanges(); - expect(spy).toHaveBeenCalledWith(action); + // expect(spy).toHaveBeenCalledTimes(1); + expect(spy).toHaveBeenCalledWith(loadDatasetSearchMetaAction); }); }); // Promise.resolve(null).then(() => this.store.dispatch(new searchActions.ChangeStepAction('result')));