All files / publisher/shared/RenderErrors RenderErrors.tsx

100% Statements 3/3
100% Branches 0/0
100% Functions 3/3
100% Lines 3/3

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          4x         4x       5x                            
type Props = {
  errors: { [key: string]: Array<string> };
};
 
function RenderErrors({ errors }: Props) {
  return (
    <div className="p-notification--negative">
      <div className="p-notification__content">
        <p className="p-notification__message">
          {Object.keys(errors).map((fileName) => (
            <span key={`errors-${fileName}`}>
              {fileName}
              &nbsp;
              {errors[fileName].map((error, index: number) => (
                <span key={`errors-${fileName}-${index}`}>
                  {error}
                  <br />
                </span>
              ))}
            </span>
          ))}
        </p>
      </div>
    </div>
  );
}
 
export default RenderErrors;