Skip to content

Commit

Permalink
test: add test for error boundary
Browse files Browse the repository at this point in the history
  • Loading branch information
Prithpal-Sooriya committed Feb 24, 2025
1 parent 6fc8cda commit b1bf6c7
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React, { FC } from 'react';
import { render } from '@testing-library/react';
import NFTGridItemErrorBoundary from './nft-grid-item-error-boundary';

describe('NFTGridItemErrorBoundary tests', () => {
it('should fallback if grid item crashes', () => {
const MockGridItem: FC = () => {
throw new Error('Mock Error');
};

const { container } = render(
<NFTGridItemErrorBoundary fallback={() => null}>
<MockGridItem />
</NFTGridItemErrorBoundary>,
);

expect(container).toBeEmptyDOMElement();
});
});

0 comments on commit b1bf6c7

Please sign in to comment.