All files / src/shared/GiveFilter/hooks useGetFilterChips.tsx

75% Statements 6/8
0% Branches 0/2
66.66% Functions 2/3
75% Lines 6/8

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              29x 3x                       29x   1094x   1094x                   1094x    
import { endpointNames } from "../constants";
import { CardPropsTypes as CardProps } from "@pages/ManageMoney/Modal/filter.types";
import {
  TClassificationsAPIResponse,
  useBusinessClassification,
} from "@components/Signup/Forms/hooks/useBusinessClassification";
 
const classificationsParser = (res: TClassificationsAPIResponse) => {
  return res?.data?.map(({ name, displayName }) => {
    const label = ["iso", "psp"].includes(name)
      ? name.toUpperCase()
      : displayName;
 
    return {
      value: name,
      label,
    };
  });
};
 
export const useGetFilterChips = () => {
  const { data: classificationOptions, isLoading: isLoadingClassifications } =
    useBusinessClassification("manage_submerchants", classificationsParser);
 
  const businessClassificationTypeChips: CardProps = {
    title: "Business Classification Type",
    chips: classificationOptions,
    selected: [],
    apiKeyName: endpointNames.className,
    isLoading: isLoadingClassifications,
  };
 
  // add more chips here ..
 
  return { businessClassificationTypeChips };
};