Skip to content

Commit

Permalink
fix: unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
dougfabris committed Jun 5, 2024
1 parent 4a4b65b commit 1f59ea8
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions packages/fuselage-toastbar/src/ToastBar.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,7 @@ const topStartStyle = {
left: '0',
};

describe('[fuselage-toastbar]', () => {
test('should dispatch the ToastBar on click', async () => {
const { container } = render(<Default />);
const button = getByRole(container, 'button');

fireEvent.click(button);
const toasts = screen.queryAllByRole('alert');
expect(toasts).toBeInTheDocument();
});

describe('[fuselage-toastbar rendering]', () => {
test('should display ToastBar on the top right of the screen by default', async () => {
render(<TopEnd />);
const toast = screen.queryByRole('alert');
Expand Down Expand Up @@ -61,3 +52,14 @@ describe('[fuselage-toastbar]', () => {
expect(toastContainer).toHaveStyle(topStartStyle);
});
});

describe('[fuselage-toastbar interacting]', () => {
test('should dispatch the ToastBar on click', async () => {
const { container } = render(<Default />);
const button = getByRole(container, 'button');

fireEvent.click(button);
const toasts = screen.queryAllByRole('alert');
toasts.forEach((toast) => expect(toast).toBeInTheDocument());
});
});

0 comments on commit 1f59ea8

Please sign in to comment.