Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
lone-star committed Jan 22, 2024
1 parent 66081a6 commit 8615bb6
Showing 1 changed file with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ describe('<Toast />', () => {
});

it('renders a leading icon if an icon is provided', () => {
const message = mountWithApp(
<Toast icon={CheckIcon} {...mockProps} />,
);
const message = mountWithApp(<Toast icon={CheckIcon} {...mockProps} />);
expect(message).toContainReactComponent(Icon, {source: CheckIcon});
});

Expand Down Expand Up @@ -213,18 +211,14 @@ describe('<Toast />', () => {
describe('onClick', () => {
it('wraps the toast in a button when provided', () => {
const spy = jest.fn();
const message = mountWithApp(
<Toast {...mockProps} onClick={spy} />,
);
const message = mountWithApp(<Toast {...mockProps} onClick={spy} />);

expect(message.find('button')).toContainReactText(mockProps.content);
});

it('fires the callback when the toast is clicked', () => {
const spy = jest.fn();
const message = mountWithApp(
<Toast {...mockProps} onClick={spy} />,
);
const message = mountWithApp(<Toast {...mockProps} onClick={spy} />);

message.find('button')?.trigger('onClick');

Expand Down

0 comments on commit 8615bb6

Please sign in to comment.