Skip to content

Commit

Permalink
fix: make test for button render its own separate test
Browse files Browse the repository at this point in the history
  • Loading branch information
Danielle254 committed Oct 13, 2024
1 parent 03aa273 commit 58a1853
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions components/AlertNotification/AlertNotification.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,30 +29,27 @@ const variantTestCases = {

describe('AlertNotification', () => {
for (const [key, value] of Object.entries(variantTestCases)) {
it(`renders the correct variant ${key} and a dismiss button`, () => {
it(`renders the correct variant ${key}`, () => {
render(
<Alert
variant={AlertVariants[key as keyof typeof AlertVariants]}
message={value.message}
/>,
);
const dismissButton = screen.getByTestId('dismiss-alert-btn');
expect(dismissButton).toBeInTheDocument();
});
};

/* it('should close the notification upon clicking the dismiss button',
async () => {
for (const [key, value] of Object.entries(variantTestCases)) {
it('should render the dismiss button on each alert type', () => {
render(
<Alert
variant={AlertVariants.Warning}
message={'This is a warning message'}
/>
variant={AlertVariants[key as keyof typeof AlertVariants]}
message={value.message}
/>,
);
const dismissButton = screen.getByTestId('dismiss-alert-btn');
fireEvent.click(dismissButton);
await waitFor(() => {
expect(dismissButton).not.toBeInTheDocument();
});
}); */
expect(dismissButton).toBeInTheDocument();
});
};

});

0 comments on commit 58a1853

Please sign in to comment.