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

80% Statements 4/5
88.88% Branches 8/9
100% Functions 1/1
100% Lines 4/4

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                105x 93x   93x   93x                                                    
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 (
    <div className="flex flex-wrap gap-x-1">
      <span className="font-semibold">
        {userRoleMap[getApprovingRole(role)]}
        {": "}
      </span>
 
      {approverList.length ? (
        <ul className="contents">
          {approverList.map((approver, index) => (
            <li key={`${approver.email}-${index}`}>
              <a className="text-blue-600" href={`mailto:${approver.email}`}>
                {approver.fullName}
                {index !== access.approverList.length - 1 && ", "}
              </a>
            </li>
          ))}
        </ul>
      ) : (
        "N/A"
      )}
    </div>
  );
};