I'm beginner in NextJS environment and I'm migrating an application from common ReactJS. That's a simple test of a link to another page. So, how I should refactor my test?
*I'm using Jest and Testing Library.
// My current code in ReactJS
test('Should go to Post page', () => {
const post = mockPostModel()
const history = createMemoryHistory({ initialEntries: ['/'] })
render(
<Router history={history}>
<BlogPost post={post} />
</Router>
)
fireEvent.click(screen.getByTestId('link'))
expect(history.location.pathname).toBe(`/post/${post.title}`)
})