Skip to content
Permalink
Browse files

[IT-2805] Add performance aspect types as initial data in measurand t…

…est.
  • Loading branch information...
DanielSteger committed Sep 10, 2019
1 parent 27104f5 commit 0054c052a0d90797f0f857c8bace91fd74ee9824
@@ -7,11 +7,14 @@ import {ResultSelectionStore} from "../../services/result-selection.store";
import {ResultSelectionService} from "../../services/result-selection.service";
import {By} from "@angular/platform-browser";
import {MeasurandGroup} from "../../../../models/measurand.model";
import {PerformanceAspectType} from "../../../../models/perfomance-aspect.model";
import {PerformanceAspectService} from "../../../../services/performance-aspect.service";

describe('MeasurandsComponent', () => {
let component: MeasurandsComponent;
let fixture: ComponentFixture<MeasurandsComponent>;
let resultSelectionStore: ResultSelectionStore;
let performanceAspectService: PerformanceAspectService;

beforeEach(async(() => {
TestBed.configureTestingModule({
@@ -28,9 +31,31 @@ describe('MeasurandsComponent', () => {
beforeEach(() => {
fixture = TestBed.createComponent(MeasurandsComponent);
resultSelectionStore = TestBed.get(ResultSelectionStore);
performanceAspectService = TestBed.get(PerformanceAspectService);
component = fixture.componentInstance;
component.multipleMeasurands = true;

const performanceAspectTypes: PerformanceAspectType[] = [
{
icon: "fas fa-hourglass-start",
name: "PAGE_CONSTRUCTION_STARTED",
unit: "ms",
kind: "performance-aspect-type"
},
{
icon: "fas fa-eye",
name: "PAGE_SHOWS_USEFUL_CONTENT",
unit: "ms",
kind: "performance-aspect-type"
},
{
icon: "fas fa-hand-pointer",
name: "PAGE_IS_USABLE",
unit: "ms",
kind: "performance-aspect-type"
}
];

const loadTimes: MeasurandGroup = {
isLoading: false,
name: 'frontend.de.iteratec.isr.measurand.group.LOAD_TIMES',
@@ -52,6 +77,7 @@ describe('MeasurandsComponent', () => {
}
]
};
performanceAspectService.aspectTypes$.next(performanceAspectTypes);
resultSelectionStore.loadTimes$.next(loadTimes);
fixture.detectChanges();
});
@@ -53,8 +53,8 @@ export class MeasurandsComponent implements OnInit {
this.loadResultSelection();
} else {
this.defaultValue$
.pipe(takeWhile((performanceAspectType: PerformanceAspectType) => performanceAspectType === undefined, true))
.subscribe((performanceAspectType: PerformanceAspectType) => this.setDefaultValue(performanceAspectType));
.pipe(takeWhile((measurand: Measurand) => measurand === undefined, true))
.subscribe((measurand: Measurand) => this.setDefaultValue(measurand));
}
}

@@ -82,7 +82,7 @@ export class MeasurandsComponent implements OnInit {
}

getDefaultValue(): void {
this.performanceAspectService.aspectTypes$.subscribe((next: PerformanceAspectType[]) => {
this.aspectTypes$.subscribe((next: PerformanceAspectType[]) => {
this.defaultValue$.next(next[0]);
});
}

0 comments on commit 0054c05

Please sign in to comment.
You can’t perform that action at this time.