Skip to content

Commit

Permalink
remove console error spy
Browse files Browse the repository at this point in the history
  • Loading branch information
broccolinisoup committed Jul 20, 2023
1 parent 662fb28 commit 96794b7
Showing 1 changed file with 0 additions and 11 deletions.
11 changes: 0 additions & 11 deletions src/UnderlineNav2/UnderlineNav.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import {
import {UnderlineNav} from '.'
import {behavesAsComponent, checkExports, checkStoriesForAxeViolations} from '../utils/testing'

declare const REACT_VERSION_LATEST: boolean

// window.matchMedia() is not implemented by JSDOM so we have to create a mock:
// https://jestjs.io/docs/manual-mocks#mocking-methods-which-are-not-implemented-in-jsdom
Object.defineProperty(window, 'matchMedia', {
Expand Down Expand Up @@ -101,7 +99,6 @@ describe('UnderlineNav', () => {
expect(nav.getElementsByTagName('svg').length).toEqual(7)
})
it('fires onSelect on click', async () => {
const spy = jest.spyOn(console, 'error').mockImplementation()
const onSelect = jest.fn()
const {getByRole} = render(
<UnderlineNav aria-label="Test Navigation">
Expand All @@ -114,14 +111,6 @@ describe('UnderlineNav', () => {
const user = userEvent.setup()
await user.click(item)
expect(onSelect).toHaveBeenCalledTimes(1)

if (REACT_VERSION_LATEST) {
expect(spy).not.toHaveBeenCalled()
} else {
// Warning: It looks like you're using the wrong act() around your test interactions
expect(spy).toHaveBeenCalledTimes(2)
}
spy.mockRestore()
})
it('fires onSelect on keypress', async () => {
const onSelect = jest.fn()
Expand Down

0 comments on commit 96794b7

Please sign in to comment.