All files / react-app/src/components/Form/content PackageSection.tsx

100% Statements 8/8
50% Branches 2/4
100% Functions 3/3
100% Lines 8/8

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 45 46        72x 17x             17x     72x 17x             17x     72x 17x                                    
import { BLANK_VALUE } from "@/consts";
import { useParams } from "react-router";
import { AuthorityUnion } from "shared-types";
 
export const getIdLabel = (authority: AuthorityUnion) => {
  const idLabels = new Map<AuthorityUnion, string>([
    ["CHIP SPA", "Package ID"],
    ["Medicaid SPA", "Package ID"],
    ["1915(b)", "Waiver Number"],
    ["1915(c)", "Waiver Number"],
  ]);
 
  return idLabels.get(authority) ?? BLANK_VALUE;
};
 
export const getAuthorityLabel = (authority: AuthorityUnion) => {
  const authorityLabels = new Map<AuthorityUnion, string>([
    ["CHIP SPA", "CHIP SPA"],
    ["Medicaid SPA", "Medicaid SPA"],
    ["1915(b)", "1915(b) Waiver"],
    ["1915(c)", "1915(c) Waiver"],
  ]);
 
  return authorityLabels.get(authority) ?? BLANK_VALUE;
};
 
export const PackageSection = () => {
  const { id, authority } = useParams<{
    id: string;
    authority: AuthorityUnion;
  }>();
 
  return (
    <section className="flex flex-col mb-8 space-y-8">
      <div>
        <p className="font-bold">{getIdLabel(authority)}</p>
        <p className="text-xl">{id}</p>
      </div>
      <div>
        <p className="font-bold">Authority</p>
        <p className="text-xl">{getAuthorityLabel(authority)}</p>
      </div>
    </section>
  );
};