All files / app/features/profile/actions FriendActions.tsx

100% Statements 7/7
50% Branches 3/6
100% Functions 1/1
100% Lines 7/7

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  3x 3x   3x             19x       19x             19x           19x      
import { SetMutationError } from "features/connections/friends";
import AddFriendButton from "features/connections/friends/AddFriendButton";
import { User } from "proto/api_pb";
 
import PendingFriendReqButton from "./PendingFriendReqButton";
 
interface FriendActionsProps {
  user: User.AsObject;
  setMutationError: SetMutationError;
}
 
export default function FriendActions({
  user,
  setMutationError,
}: FriendActionsProps) {
  Iif (user.friends === User.FriendshipStatus.NOT_FRIENDS) {
    return (
      <AddFriendButton
        userId={user.userId}
        setMutationError={setMutationError}
      />
    );
  } else Iif (
    user.pendingFriendRequest &&
    user.pendingFriendRequest.sent === false
  ) {
    return <PendingFriendReqButton friendRequest={user.pendingFriendRequest} />;
  } else {
    return null;
  }
}