All files / lib/packages/shared-utils legacy-event-type.ts

100% Statements 13/13
58.82% Branches 20/34
50% Functions 1/2
100% Lines 12/12

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 47 48      215x 9x 1x   8x   8x                   1x           1x             1x   1x             1x   3x 3x      
import { Action } from "shared-types";
 
// Resolve the action type based on the GSI1pk
export const getLegacyEventType = (gsi1pk: string) => {
  if (gsi1pk === "") {
    return undefined;
  }
  const submitType = gsi1pk.split("OneMAC#submit")?.[1] || "";
 
  switch (submitType) {
    case "chipspa":
    case "medicaidspa":
    case "waiveramendment":
    case "waiverappk":
    case "waiverextension":
    case "waiverextensionb":
    case "waiverextensionc":
    case "waivernew":
    case "waiverrenewal":
      return "new-legacy-submission";
    case "chipsparai":
    case "medicaidsparai":
    case "waiveramendmentrai":
    case "waiverappkrai":
    case "waiverrai":
      return Action.RESPOND_TO_RAI;
    case "chipspawithdraw":
    case "medicaidspawithdraw":
    case "waiveramendmentwithdraw":
    case "waiverappkwithdraw":
    case "waivernewwithdraw":
    case "waiverrenewalwithdraw":
      return Action.WITHDRAW_PACKAGE;
    case "rairesponsewithdraw":
      return Action.LEGACY_WITHDRAW_RAI_REQUEST;
    case "medicaidspasubsequent":
    case "chipspasubsequent":
    case "waiverappksubsequent":
    case "waivernewsubsequent":
    case "waiverrenewalsubsequent":
    case "waiveramendmentsubsequent":
      return Action.UPLOAD_SUBSEQUENT_DOCUMENTS;
    default:
      console.log(`Unhandled event type for ${submitType}.  Doing nothing and continuing.`);
      return undefined;
  }
};