All files / lib/packages/shared-utils package-activity.ts

100% Statements 9/9
89.47% Branches 17/19
66.66% Functions 4/6
100% Lines 9/9

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 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44      45x                       6x   6x     6x   8x   13x   6x         2x                   1x    
import type { changelog } from "shared-types/opensearch";
 
export function getPackageActivityLabel(event: changelog.Document["event"]): string {
  switch (event) {
    case "capitated-amendment":
    case "capitated-initial":
    case "capitated-renewal":
    case "contracting-amendment":
    case "contracting-initial":
    case "contracting-renewal":
    case "new-chip-submission":
    case "new-chip-details-submission":
    case "new-medicaid-submission":
    case "temporary-extension":
    case "app-k":
      return "Initial Package Submitted";
    case "withdraw-package":
      return "Package - Withdrawal Requested";
    case "legacy-withdraw-rai-request":
    case "withdraw-rai":
      return "Formal RAI Response - Withdrawal Requested";
    case "respond-to-rai":
      return "RAI Response Submitted";
    case "upload-subsequent-documents":
      return "Subsequent Document(s) Uploaded";
    default:
      return "";
  }
}
 
export function slugifyPackageActivityLabel(label: string): string {
  return label
    .replace(/\(s\)/gi, "s")
    .trim()
    .toLowerCase()
    .replace(/[^a-z0-9]+/g, "-")
    .replace(/^-+|-+$/g, "")
    .replace(/-{2,}/g, "-");
}
 
export function getPackageActivityLabelSlug(event: changelog.Document["event"]): string {
  return slugifyPackageActivityLabel(getPackageActivityLabel(event)) || "package-activity";
}