Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mwarman committed Mar 22, 2024
1 parent 8641eb9 commit f2e14f2
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/pages/ComponentsPage/components/CardComponents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ interface CardComponentsProps extends PropsWithClassName, PropsWithTestId {}

const CardComponents = ({
className,
testId = 'components-badge',
testId = 'components-card',
}: CardComponentsProps): JSX.Element => {
const columnHelper = createColumnHelper<ComponentProperty>();
const cardData: ComponentProperty[] = [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { render, screen } from 'test/test-utils';
import CardComponents from '../CardComponents';

describe('CardComponents', () => {
it('should render successfully', async () => {
// ARRANGE
render(<CardComponents />);
await screen.findByTestId('components-card');

// ASSERT
expect(screen.getByTestId('components-card')).toBeDefined();
});

it('should use custom testId', async () => {
// ARRANGE
render(<CardComponents testId="custom-testId" />);
await screen.findByTestId('custom-testId');

// ASSERT
expect(screen.getByTestId('custom-testId')).toBeDefined();
});

it('should use custom className', async () => {
// ARRANGE
render(<CardComponents className="custom-className" />);
await screen.findByTestId('components-card');

// ASSERT
expect(screen.getByTestId('components-card').classList).toContain('custom-className');
});
});

0 comments on commit f2e14f2

Please sign in to comment.