Skip to content

Commit

Permalink
mock useLocation for ApiSpecSelector.spec.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
jkaster committed Sep 3, 2021
1 parent 67e81e5 commit 2af9b33
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@ import { ApiSpecSelector } from './ApiSpecSelector'

const specState = getLoadedSpecState()

jest.mock('react-router-dom', () => {
const ReactRouterDOM = jest.requireActual('react-router-dom')
return {
...ReactRouterDOM,
useLocation: () => ({
pathname: '/4.0/methods/Dashboard/dashboard',
}),
}
})

describe('ApiSpecSelector', () => {
const specDispatch = jest.fn()
Element.prototype.scrollIntoView = jest.fn()
Expand Down

0 comments on commit 2af9b33

Please sign in to comment.