Skip to content

Commit

Permalink
test(badge): suppress expected console error
Browse files Browse the repository at this point in the history
  • Loading branch information
Jin Lee committed Feb 17, 2023
1 parent 8067e02 commit 4425199
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/components/Badge/Badge.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ describe('<Badge />', () => {
generateSnapshots(stories);

test('throws an error if Badge.Text length is > 3', () => {
// expect console error from react, suppressed.
const consoleErrorMock = jest.spyOn(console, 'error');
consoleErrorMock.mockImplementation();
expect(() => {
render(
<Badge>
Expand All @@ -16,5 +19,6 @@ describe('<Badge />', () => {
</Badge>,
);
}).toThrow(/Max badge text length is 3/);
consoleErrorMock.mockRestore();
});
});

0 comments on commit 4425199

Please sign in to comment.