mirror of
https://github.com/callstack/agent-device.git
synced 2026-09-14 20:06:34 +08:00
2a9a4ee80c
* test: add Linux platform command coverage manifest * test: address platform coverage review feedback
43 lines
942 B
TypeScript
43 lines
942 B
TypeScript
export type CoverageClassificationLevel =
|
|
| 'live'
|
|
| 'command-contract'
|
|
| 'capability-denial'
|
|
| 'known-gap';
|
|
|
|
export type CoverageClassificationSummary = {
|
|
capabilityDenial: number;
|
|
contract: number;
|
|
gap: number;
|
|
live: number;
|
|
total: number;
|
|
};
|
|
|
|
export function buildCoverageClassificationSummary(
|
|
entries: readonly { level: CoverageClassificationLevel }[],
|
|
): CoverageClassificationSummary {
|
|
const summary: CoverageClassificationSummary = {
|
|
capabilityDenial: 0,
|
|
contract: 0,
|
|
gap: 0,
|
|
live: 0,
|
|
total: entries.length,
|
|
};
|
|
for (const entry of entries) {
|
|
switch (entry.level) {
|
|
case 'live':
|
|
summary.live += 1;
|
|
break;
|
|
case 'command-contract':
|
|
summary.contract += 1;
|
|
break;
|
|
case 'capability-denial':
|
|
summary.capabilityDenial += 1;
|
|
break;
|
|
case 'known-gap':
|
|
summary.gap += 1;
|
|
break;
|
|
}
|
|
}
|
|
return summary;
|
|
}
|