Skip to content

Commit

Permalink
Remove defaultProps in Ship and TicTacToe
Browse files Browse the repository at this point in the history
  • Loading branch information
CalCorbin committed Nov 1, 2024
1 parent e1606cf commit 713813e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"firebase": "^11.0.1",
"graphql": "16.9.0",
"next": "^15.0.2",
"node-fetch": "3.3.2",
"node-fetch": "^2.6.6",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-query": "^3.39.3",
Expand Down
6 changes: 3 additions & 3 deletions src/components/Ship/Ship.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ const mockShip: IShip = {
describe('<Ship />', () => {
afterEach(cleanup);

it('should render', () => {
render(<Ship ship={mockShip.ship} />);
expect(screen.getByTestId('ship-GOMSTREE')).toBeInTheDocument();
it('should not render with null data', () => {
render(<Ship />);
expect(screen.queryByTestId('ship-GOMSTREE')).toBeNull();
});

it('should render weightless ship', () => {
Expand Down
6 changes: 2 additions & 4 deletions src/components/Ship/Ship.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ const Ship = ({ ship }: IShip) => {
setIsOpen((prev) => !prev);
};

if (!ship) return null;

return (
<div
className={styles['ship-card']}
Expand Down Expand Up @@ -88,8 +90,4 @@ const Ship = ({ ship }: IShip) => {
);
};

Ship.defaultProps = {
ship: null,
};

export default Ship;
6 changes: 1 addition & 5 deletions src/components/TicTacToe/BoardRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const BoardRow = ({
rowIndex,
onCellClick,
board,
winningCells,
winningCells = [],
}: BoardRowProps) => {
let borderClasses = '';

Expand Down Expand Up @@ -49,8 +49,4 @@ const BoardRow = ({
);
};

BoardRow.defaultProps = {
winningCells: [],
};

export default BoardRow;

0 comments on commit 713813e

Please sign in to comment.