Skip to content

Cody/add tests for NavDrawer#652

Open
kepsteen wants to merge 5 commits intodevelopfrom
Cody/unit-tests-NavDrawer
Open

Cody/add tests for NavDrawer#652
kepsteen wants to merge 5 commits intodevelopfrom
Cody/unit-tests-NavDrawer

Conversation

@kepsteen
Copy link
Copy Markdown
Contributor

@kepsteen kepsteen commented Nov 4, 2024

Closes #223

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

@appwrite
Copy link
Copy Markdown

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!

@vercel
Copy link
Copy Markdown

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

Comment thread components/NavDrawer/NavDrawer.test.tsx
Comment thread components/NavDrawer/NavDrawer.test.tsx
Copy link
Copy Markdown
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.

Comment thread components/NavDrawer/NavDrawer.tsx Outdated
Comment thread components/NavDrawer/NavDrawer.test.tsx Outdated
Comment thread components/NavDrawer/NavDrawer.test.tsx
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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