Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dominick/ Closes #613 Add unit test for <AlertTitle /> component #618

Merged
merged 5 commits into from
Oct 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions components/AlertTItle/AlertTitle.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from 'react';
import { render } from '@testing-library/react';
import { AlertTitle } from './AlertTitle';

describe('AlertTitle', () => {
it('renders the title text', () => {
Copy link
Contributor

@choir241 choir241 Oct 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: Based on your PR description, how are we making sure that the passed in string is a string? NIT: Your PR description, ensuring it matches the declared prop type, which is a string. doesn't match what you're testing here. Please update this.

Copy link
Contributor

@mhchen mhchen Oct 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't TypeScript do this already? Why would it need a separate test?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mhchen it was more of a question about the PR description itself

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can do! @choir241 does this work?

const { getByText } = render(<AlertTitle title="Test Title" />);
alexappleget marked this conversation as resolved.
Show resolved Hide resolved
expect(getByText('Test Title')).toBeInTheDocument();
alexappleget marked this conversation as resolved.
Show resolved Hide resolved
});
});