expect(infoGroups.length).toBe(3);
const infoCards = fixture.debugElement.nativeElement.querySelectorAll('cd-info-card');
- expect(infoCards.length).toBe(18);
+ expect(infoCards.length).toBe(17);
});
describe('features disabled', () => {
expect(infoGroups.length).toBe(3);
const infoCards = fixture.debugElement.nativeElement.querySelectorAll('cd-info-card');
- expect(infoCards.length).toBe(15);
+ expect(infoCards.length).toBe(14);
});
});
expect(infoGroups.length).toBe(2);
const infoCards = fixture.debugElement.nativeElement.querySelectorAll('cd-info-card');
- expect(infoCards.length).toBe(10);
+ expect(infoCards.length).toBe(9);
});
it('should render all except "Performance" group and cards', () => {
expect(infoGroups.length).toBe(2);
const infoCards = fixture.debugElement.nativeElement.querySelectorAll('cd-info-card');
- expect(infoCards.length).toBe(13);
+ expect(infoCards.length).toBe(12);
});
it('should render all groups and 1 card per group', () => {
});
describe('preparePgStatus', () => {
- const calcPercentage = (data: number) => Math.round((data / 10) * 100) || 0;
-
- const expectedChart = (data: number[]) => ({
+ const expectedChart = (data: number[], label: string = null) => ({
labels: [
- `Clean (${calcPercentage(data[0])}%)`,
- `Working (${calcPercentage(data[1])}%)`,
- `Warning (${calcPercentage(data[2])}%)`,
- `Unknown (${calcPercentage(data[3])}%)`
+ `Clean: ${component['dimless'].transform(data[0])}`,
+ `Working: ${component['dimless'].transform(data[1])}`,
+ `Warning: ${component['dimless'].transform(data[2])}`,
+ `Unknown: ${component['dimless'].transform(data[3])}`
],
options: {},
- dataset: [{ data: data }]
+ dataset: [
+ {
+ data: data.map((i) =>
+ component['calcPercentage'](
+ i,
+ data.reduce((j, k) => j + k)
+ )
+ ),
+ label: label
+ }
+ ]
});
it('gets no data', () => {
component.preparePgStatus(chart, {
pg_info: {}
});
- expect(chart).toEqual(expectedChart([undefined, undefined, undefined, undefined]));
+ expect(chart).toEqual(expectedChart([0, 0, 0, 0], '0\nPGs'));
});
it('gets data from all categories', () => {
}
}
});
- expect(chart).toEqual(expectedChart([1, 2, 3, 4]));
+ expect(chart).toEqual(expectedChart([1, 2, 3, 4], '10\nPGs'));
});
});