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

Cody/add tests for NavDrawer #652

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open

Conversation

kepsteen
Copy link
Contributor

@kepsteen kepsteen commented Nov 4, 2024

Closes #223

  • added test for drawer open/close functionality
  • added test for rendering Drawer sub-components properly

Copy link

appwrite bot commented Nov 4, 2024

Gridiron Survivor Application 6616ea581ef9f5521c7d

Function ID Status Action
Your function has been successfully deployed.

Project name: Gridiron Survivor Application
Project ID: 6616ea581ef9f5521c7d

Function ID Status Action
userAuth 6626fef885a9f630442b ready Ready View Logs

Only deployments on the production branch are activated automatically. If you'd like to activate this deployment, navigate to your deployments. Learn more about Appwrite Function deployments.

💡 Did you know?
Appwrite has a Discord community with over 16 000 members. Come join us!

Copy link

vercel bot commented Nov 4, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
gridiron-survivor ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 16, 2024 5:02pm
gridiron-survivor-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 16, 2024 5:02pm

Copy link
Collaborator

@shashilo shashilo left a comment

Choose a reason for hiding this comment

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

For this, I'm expecting a unit test for each functional component. Even though Drawer brings them all in, each functional component should have its own isolated unit tests.

Copy link
Collaborator

@shashilo shashilo left a comment

Choose a reason for hiding this comment

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

If this component is called NavDrawer, why do have have all these drawer components inside of it? The only thing NavDrawer is the name.

<DrawerClose>
<X />
<DrawerClose data-testid="drawer-close">
<X data-testid="drawer-close-icon" />
Copy link
Collaborator

Choose a reason for hiding this comment

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

BEM naming convention please.

Suggested change
<X data-testid="drawer-close-icon" />
<X data-testid="drawer-close__icon" />


describe('DrawerHeader Component', () => {
it('renders with default classes', () => {
render(<DrawerHeader data-testid="drawer-header" />);
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should not be manually setting data-testid's via test. These attributes should be part of the component.

render(<DrawerHeader data-testid="drawer-header" />);

const header = screen.getByTestId('drawer-header');
expect(header).toHaveClass(
Copy link
Collaborator

Choose a reason for hiding this comment

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

No need to test the styles. E2E testing will cover this. Whenever we get it. Instead, test the default state and the props coming in to the component. Ensure they work as intended and change and intended.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add unit test for NavDrawer component
4 participants