Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion modules/ui/src/app/mocks/testrun.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ export const TEST_DATA_RESULT: IResult[] = [
'The device should use the DNS server provided by the DHCP server',
result: 'Non-Compliant',
},
{
name: 'dns.mdns',
description: 'Does the device has MDNS (or any kind of IP multicast)',
result: 'Not Started',
},
];

export const TEST_DATA_RESULT_WITH_RECOMMENDATIONS: IResult[] = [
Expand All @@ -50,7 +55,7 @@ export const TEST_DATA_RESULT_WITH_RECOMMENDATIONS: IResult[] = [

export const TEST_DATA_TABLE_RESULT: IResult[] = [
...TEST_DATA_RESULT,
...new Array(24).fill(null).map(() => ({}) as IResult),
...new Array(23).fill(null).map(() => ({}) as IResult),
];

export const EMPTY_RESULT = new Array(100)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ describe('ProgressStatusCardComponent', () => {
});

it('should return correct test result if status "Compliant"', () => {
const expectedResult = '2/2';
const expectedResult = '2/3';

const result = component.getTestsResult(MOCK_PROGRESS_DATA_COMPLIANT);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
import {
IResult,
StatusOfTestResult,
StatusOfTestrun,
TestrunStatus,
TestsData,
Expand Down Expand Up @@ -65,11 +66,11 @@ export class TestrunStatusCardComponent {
(data.tests as TestsData)?.results?.length &&
(data.tests as TestsData)?.total
) {
return `${(data.tests as TestsData)?.results?.length}/${
return `${(data.tests as TestsData)?.results?.filter(result => result.result !== StatusOfTestResult.NotStarted).length}/${
(data.tests as TestsData)?.total
}`;
} else if ((data.tests as IResult[])?.length) {
return `${(data.tests as IResult[])?.length}/${
return `${(data.tests as IResult[])?.filter(result => result.result !== StatusOfTestResult.NotStarted).length}/${
(data.tests as IResult[])?.length
}`;
}
Expand Down Expand Up @@ -99,7 +100,13 @@ export class TestrunStatusCardComponent {
const testData = data.tests as TestsData;

if (testData && testData.total && testData.results?.length) {
return Math.round((testData.results.length / testData.total) * 100);
return Math.round(
(testData.results.filter(
result => result.result !== StatusOfTestResult.NotStarted
).length /
testData.total) *
100
);
}
return 0;
}
Expand Down