All Questions
8 questions
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/...
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 ...
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 ...
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....
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 = () => {
...
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()}>
...
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 ...
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-...