Skip to main content

All Questions

Filter by
Sorted by
Tagged with
0 votes
0 answers
241 views

Vitest, async await, - The error was thrown, while Vitest was running this test

import React from "react"; import { render } from "@testing-library/react"; import { screen } from "@testing-library/dom"; import MultiSelect from "@/components/...
Robson Barbosa's user avatar
0 votes
0 answers
128 views

NextRouter was not mounted. https://nextjs.org/docs/messages/next-router-not-mounted

I got this error when testing with react testing library with jest. Anyone help me to do it. I want to rectify this error and run the test. The error pointed to the code which I was testing. I should ...
Hana G's user avatar
  • 1
0 votes
0 answers
42 views

Test failures after upgrading Next from 12 to 13/ or 14

I am upgrading a Next application in accordance with some library vulnerabilities and failing at the first hurdle! I am currently on 12.2.0. When I try and upgrade to 13+ I get a LOT of test suite ...
James's user avatar
  • 2,860
0 votes
1 answer
740 views

TestingLibraryElementError: Unable to find an accessible element with the role "link" in the Next.js application

In the Next.js application, I am getting the error TestingLibraryElementError: Unable to find an accessible element with the role "link" while performing below assertion - expect(screen....
paraS elixiR's user avatar
  • 2,644
3 votes
0 answers
382 views

not able to mock router.push react-testing - **expect(jest.fn()).toHaveBeenCalledWith(...expected)**

Here I am trying to mock router.push but it doesn't seem to work, I tried different approach and still facing the same issue here's the code of my component const onProceed = () => { ...
JisTheUser's user avatar
0 votes
0 answers
469 views

How to test methods in functional component for nextjs components

Component: const Demo = () => { const handler = () => { // some logic written }; return ( <div> <button data-testid={'handler_id'} onClick={() => handler()}> ...
Sridhar Natuva's user avatar
0 votes
0 answers
962 views

Testing Window.Location.Pathname testing library + jest

I'm trying to write a test to check if the loan page path is comparators/loans. But the test doesn't work, because if I change the url, the test still passes. What's wrong here? describe('URL page ...
Renan Bessa's user avatar
1 vote
1 answer
6k views

fireEvent.Blur() is not working in my custom input component

// Custom Input component const Container = styled.div``; const InputBase = styled.div<{ width: string }>` display: flex; width: ${(props) => props.width}; height: 42px; justify-...
David Cho's user avatar