Skip to content
Snippets Groups Projects
Commit 2b026abe authored by Tifenn Guillas's avatar Tifenn Guillas
Browse files

WIP: Tests on result container

parent 74797558
No related branches found
No related tags found
2 merge requests!113Develop,!101Resolve "Fix SQ issues + add tests"
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')));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment