All files / react-app/src/components/Profile/RoleStatusCard ApproverInfo.tsx

83.33% Statements 5/6
88.88% Branches 8/9
100% Functions 2/2
100% Lines 5/5

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                97x 85x   85x   85x                   122x                          
import { getApprovingRole, userRoleMap } from "shared-utils";
 
import { RoleStatusProps } from ".";
 
type ApproverInfoProps = {
  access: RoleStatusProps["access"];
};
 
export const ApproverInfo = ({ access }: ApproverInfoProps) => {
  const { role, status, approverList = [] } = access;
 
  const hideApprovers = status !== "pending" && role === "norole";
 
  Iif (hideApprovers) return null;
 
  return (
    <>
      <span className="font-semibold">
        {userRoleMap[getApprovingRole(role)]}
        {": "}
      </span>
      {approverList.length
        ? approverList.map((approver, index) => (
            <a
              className="text-blue-600"
              href={`mailto:${approver.email}`}
              key={`${approver.fullName}-${index}`}
            >
              {approver.fullName}
              {index !== access.approverList.length - 1 && ", "}
            </a>
          ))
        : "N/A"}
    </>
  );
};