All files / publisher-admin/utils getInvitesByStatus.ts

90% Statements 9/10
87.5% Branches 7/8
100% Functions 4/4
85.71% Lines 6/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                24x 8x     16x 8x     8x 8x              
import { isPending, isExpired, isRevoked } from "../utils";
 
import type { Invite } from "../types";
 
function getInvitesByStatus(
  invites: Array<Invite>,
  status: "pending" | "expired" | "revoked"
) {
  if (status === "pending") {
    return invites.filter((invite) => isPending(invite));
  }
 
  if (status === "expired") {
    return invites.filter((invite) => isExpired(invite));
  }
 
  Eif (status === "revoked") {
    return invites.filter((invite) => isRevoked(invite) && !isExpired(invite));
  }
 
  return invites;
}
 
export default getInvitesByStatus;