All files / src/components/BankAccounts BankProviderText.tsx

100% Statements 6/6
100% Branches 4/4
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                    53x 14x             53x 32x   14x            
import { Text } from "@common/Text";
import { SxProps } from "@mui/material";
import GiveText from "@shared/Text/GiveText";
import { findBankByRoutingNumber } from "@utils/bank_list";
 
type Props = {
  routingNumber: string;
  sx?: SxProps;
};
 
export const BankProviderText = ({ routingNumber }: Props) => {
  return (
    <Text color="#8F8F8F" ml={1} mt={0.5}>
      {routingNumber.length === 9 && findBankByRoutingNumber(routingNumber)}
    </Text>
  );
};
 
export const GiveBankProviderText = ({ routingNumber, sx }: Props) => {
  if (routingNumber.length !== 9) return null;
 
  return (
    <GiveText variant="bodyS" color="secondary" ml={1} mt={0.5} sx={sx}>
      {findBankByRoutingNumber(routingNumber)}
    </GiveText>
  );
};