/** * @module tools/scoring/api-coverage * * Computes the `api-test-coverage` dimension for the automation maturity score. * * Weight: 0.15. The six existing dimensions have been rebalanced to sum to 1.0: * * Before (sum = 1.0): * test-coverage-breadth 0.28 * framework-adoption 0.22 * test-id-hygiene 0.18 * ci-integration 0.14 * auth-test-coverage 0.10 * component-test-ratio 0.08 * ──── * 1.00 * * After (sum = 1.0, api-test-coverage added at 0.15): * test-coverage-breadth 0.24 (-0.04) * framework-adoption 0.19 (-0.03) * test-id-hygiene 0.15 (-0.03) * ci-integration 0.12 (-0.02) * auth-test-coverage 0.09 (-0.01) * component-test-ratio 0.06 (-0.02) * api-test-coverage 0.15 (new) * ──── * 1.00 * * Scoring rules: * - If 0 API endpoints discovered → applicability = 'not_applicable' (excluded from denominator) * - A test file "covers" an endpoint if: * (a) the endpoint path appears verbatim in the file's coveredPaths, OR * (b) the file name contains a token from the endpoint path (heuristic fallback) * - Each endpoint that is covered raises the score proportionally. * - POST/PUT/DELETE endpoints are HIGH severity gaps when untested; * GET endpoints are MEDIUM severity gaps when untested. * * Evidence is per-endpoint and contextual: * "GET /api/users — found in app/api/users/route.ts, covered by tests/api/users.test.ts" * "POST /api/orders — found in app/api/orders/route.ts, NOT covered" */ import type { RepoAnalysis } from '../../schemas/repo-analysis.schema.js'; import type { AutomationMaturityDimension } from '../../schemas/automation-maturity.schema.js'; import type { ApiSurface, DiscoveredEndpoint } from '../repo/api-surface.js'; export declare const W_API_COVERAGE = 0.15; /** * Rebalanced weights for the original 6 dimensions (sum = 0.85). * Export these so automation-maturity.ts can import and use them. */ export declare const REBALANCED_WEIGHTS: { readonly TEST_BREADTH: 0.24; readonly FRAMEWORK: 0.19; readonly TEST_ID: 0.15; readonly CI: 0.12; readonly AUTH_TESTS: 0.09; readonly COMPONENT_RATIO: 0.06; }; export interface ApiEndpointCoverage { method: DiscoveredEndpoint['method']; path: string; sourceFile: string; sourceTier: DiscoveredEndpoint['sourceTier']; covered: boolean; coveringTestFile?: string; severity: 'high' | 'medium' | 'low'; } export interface ApiCoverageResult { dimension: AutomationMaturityDimension; endpointCoverage: ApiEndpointCoverage[]; untestedHighSeverityCount: number; untestedMediumSeverityCount: number; } export declare function computeApiCoverage(repo: RepoAnalysis, apiSurface: ApiSurface): ApiCoverageResult; //# sourceMappingURL=api-coverage.d.ts.map