All files / apps/developer-portal/layers/workflows/shared complexity.ts

100% Statements 5/5
100% Branches 4/4
100% Functions 3/3
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10      47x 456x     47x 62x  
import type { Capability } from "./types/Capability.ts";
 
/** The template's estimates summed over these blocks; a block without one adds nothing. */
export const complexityOf = (capabilities: Capability[]): number =>
    capabilities.reduce((sum, { complexity }) => sum + (complexity ?? 0), 0);
 
/** A shared ticket splits its points between blocks, so a share keeps one decimal to still add up. */
export const formatPoints = (value: number): string =>
    Number.isInteger(value) ? String(value) : value.toFixed(1);