Shared:Components:Box: fix tests

This commit is contained in:
Timofey Boyko 2023-11-24 12:25:03 +03:00
parent 49b8dcbfc5
commit 57c507426d
3 changed files with 5 additions and 6 deletions

View File

@ -5,8 +5,8 @@ import "@testing-library/jest-dom";
import { Box } from ".";
test("<Box />", () => {
render(<Box testId="test" />);
test("<Box />: render without error", () => {
render(<Box />);
expect(screen.queryByTestId("test")).toBeInTheDocument();
expect(screen.queryByTestId("box")).toBeInTheDocument();
});

View File

@ -66,5 +66,4 @@ export interface BoxProps {
widthProp?: string;
children?: React.ReactNode;
testId?: string;
}

View File

@ -3,8 +3,8 @@ import { BoxProps } from "./Box.types";
import { StyledBox } from "./Box.styled";
function Box(props: BoxProps) {
const { as, testId } = props;
return <StyledBox {...props} as={as || "div"} data-testid={testId} />;
const { as } = props;
return <StyledBox {...props} as={as || "div"} data-testid="box" />;
}
Box.defaultProps = {