Skip to main content
Filter by
Sorted by
Tagged with
0 votes
0 answers
64 views

I'm testing a Backstage plugin component that renders a list of Ansible components using the Backstage Table from @backstage/core-components. In my test, I mock the catalog API to return 2 entities (...
Pavan P Jangale's user avatar
0 votes
1 answer
82 views

I have a component like this to test: import {doSomethingMocked} form 'mockedLibrary'; const TheComponent = (props) => { const [isToTest, setIsToTest] = useState(false); const handleClick = ...
Daniel Reinaldo Zorro Forero's user avatar
-1 votes
2 answers
763 views

I am new to Next.js but not to React and Jest; this is the first test suite I'm setting up in Next.js. I have the following (extremely minimal, but this example does cause the error) component I am ...
cdyswnnr's user avatar
-1 votes
1 answer
574 views

I am experiencing an issue after upgrading to React-Router version 7.6.2. I was able to replicate the failure: StackBlitz. Note that this test passed when I had v6 of React-Router-DOM. The problem ...
Zlatan Sadibasic's user avatar
0 votes
1 answer
217 views

I have the following hook: function useWelcomeMessage() { const { data, error} = useGetWelcomeMessage(); const printMessage = useCallback(async () => { if (data) { alert(data) ...
Mark's user avatar
  • 2,031
0 votes
1 answer
33 views

I'm wondering if it's better to use findBy together with rejects.toThrow instead of using queryBy with not.toBeInTheDocument when checking that an element is not displayed in cases like the following. ...
Ken's user avatar
  • 1
0 votes
1 answer
45 views

I am testing my Input element by 2 way. adding value and click on button to "todo list" works fine adding value and enter the "input' field, but throws error. I am seeking ...
3gwebtrain's user avatar
  • 15.5k
1 vote
1 answer
156 views

Using NextJS 14 and react testing-library, we previously used to test client components and client-only pages that take dynamic URL parameters like this: type PageProps = { params: { date: string }...
James Crowley's user avatar
1 vote
0 answers
93 views

I know that this is a well trodden topic, but most of the articles and help topics on this talk about how to avoid, and don't actually detail what exactly causes it. I have a simple example of how we ...
dwjohnston's user avatar
  • 12.5k
0 votes
0 answers
95 views

I am trying to set up unit tests for a frontend project. Currently, i am trying to use vitest, since we use vite as well. Additionally i am going with HappyDom and TestingLibrary. Now, i am facing a ...
UberKong's user avatar
0 votes
1 answer
204 views

I'm building a NextJS (react) app with Chakra UI (version 3). I'd like to write unit tests, but I don't know to handle the way Chakra UI v3 handles select. Here's a sample test app: 'use client'; ...
John Tang Boyland's user avatar
0 votes
0 answers
128 views

I am using ToolbarPlugin from Lexical and using the code from Lexical repo. My Sonarqube has flagged below code for test coverage and am not sure what test needs to be inlcuded: `const $updateToolbar =...
Wolvoine41's user avatar
0 votes
0 answers
39 views

how to write unit tests for useUpdateTodo hook without mock useGetUserId // Get the user const useGetUserId = ()=>{ const { data: user } = useQuery({ queryKey: ['user', email], queryFn: ...
StanStanStan's user avatar
1 vote
1 answer
96 views

While learning React, I'm trying to understand custom hooks. I've created a simple one updating an internal "step" on creation, cleanup, and allows for external updates. But I'm struggling ...
Dgurio's user avatar
  • 13
-2 votes
1 answer
101 views

After a lot of trial and error I cannot get RTL to render any components from react-router-dom. I am using [email protected], @testing-library/[email protected], @testing-library/[email protected], react-router-...
rdn's user avatar
  • 1
0 votes
1 answer
51 views

I'm stuck on a validation scenario in my Nextjs app, I have a form with some inputs and when a user tries to submit an invalid form an error message should be shown in the form. However I think there ...
jordan's user avatar
  • 359
0 votes
0 answers
123 views

I'm currently writing UTs using vitest & react-testing library for my Next.js 14 application and I'm facing issues with the usePathname hook from next/navigation. The usePathname hook is returning ...
Prajwal Kulkarni's user avatar
0 votes
1 answer
429 views

In my <App /> component I want to show a loading screen until I've fetched my data and after fetching my data all the images(whose source's I got from my data) are loaded. I am having difficulty ...
vatsal chauhan's user avatar
1 vote
1 answer
75 views

Earlier I was using NextJS 12 version & we stop generating the dynamic CSS class while writing the snapshot in React Testing Library by using the below method: mocks\styled-jsx\css.js function css(...
Nishant Pandya's user avatar
0 votes
1 answer
119 views

I'm testing a styled button component in a Next.js 13+ App Router project using Jest and React Testing Library, but my tests fail when checking for style changes on hover. Component (TestButton.tsx): ...
Haitam-Elgharras's user avatar
-2 votes
1 answer
55 views

Using @testing-library/react": "^16.0.1", I would like to know the correct approach to handle my current scenario. Here is my filter pane [using from Material UI filter slot similar to ...
3gwebtrain's user avatar
  • 15.5k
-1 votes
1 answer
59 views

I have a hook that retrieves data from a firebase backend if the storage is clear. The unit test keeps failing as a result of the null return value. Here's the hook import { useEffect, useState } from ...
D.Hodges's user avatar
  • 2,119
1 vote
0 answers
45 views

I have a simple Jest snapshot test, and upon failure, I would like to print a custom error message to remind the developer that if they intentionally failed the test, they need to ensure they update ...
Attila's user avatar
  • 1,177
1 vote
0 answers
184 views

I am trying to assert that a component has a certain style in one of my tests. In the browser this component has the correct style but when I run my vitest test I get an incorrect style. It looks like ...
Peter's user avatar
  • 340
0 votes
0 answers
40 views

I am displaying a loading indicator whilst I wait for an async process to occur, however I believe my test might be missing it being displayed because the async process is too quick? const [isLoading, ...
physicsboy's user avatar
  • 6,466
0 votes
0 answers
50 views

I am writing a React component that wraps an external web-component. Since this is external I want to wrap it in an error boundary. Everything works in production, but I encounter some problems when ...
Sparkmuse's user avatar
0 votes
0 answers
33 views

This is simple App.jsx import React, { useState } from 'react'; const App = () => { const [showDialogue, setShowDialogue] = useState(false); const handleButtonClick = async () => { ...
Trinu's user avatar
  • 1,759
0 votes
0 answers
48 views

I'm trying to push my brach-code for merging, but I'm stuck on this error after I tried running the command: npm test Error: Test suite failed to run ReferenceError: global is not defined ...
Khushi's user avatar
  • 1
1 vote
1 answer
687 views

I'm working on a React app that is tested with jest, and so far things have been going well. I have a component that relies on a service that shuffles a deck of cards. The component relies on this ...
Surfdaweb's user avatar
0 votes
1 answer
62 views

With prior versions of react-tooltip, I was able to simply render the tooltip without even having to trigger a user interaction, with v5.28, even with userEvents, I am still unable to get the tooltip ...
fernando91's user avatar
0 votes
0 answers
59 views

I am having an issue running tests with jest and RTL. In my jest.config.js I have this: const config = { transform: { ".*": "babel-jest", "^.+\\.(gql|graphql)$":...
CodeConnoisseur's user avatar
0 votes
0 answers
453 views

I'm trying to set some unit tests, but since I use in my axios file import.meta I gives me this error. I've tried everything with babel, but still gives this error. My client doesn't want that I ...
Maria Scetta's user avatar
0 votes
0 answers
26 views

I'm using Jest with Testing Library on TypeScript. When I try to use the render function (from Testing Library) to load a component with this type of import, for example: import backgroundImage from '@...
João Périco's user avatar
0 votes
0 answers
45 views

I have this function which is used as a wrapper which is needed for multiple component test cases to pass. It's in a file called customWrapper.js. So essentially I use render from here for other test ...
karvai's user avatar
  • 1,836
0 votes
0 answers
42 views

Im trying to setup tests for my company's app. The app runns perfectly, but when i run tests i get the following error: Cannot find module @myCompany/custom-react-components from 'src/contentArea/...
Admir Husić's user avatar
1 vote
0 answers
149 views

I am new in Jest and React Testing Library and want to test my Form created with Formik and Yup. The test should test when the User inputs invalid values, that the Submit Button should be disabled. I ...
Sugirthan's user avatar
0 votes
0 answers
39 views

I am using NextJS with React Testing Library for component testing. I have a tinymce editor that loads from a CDN. When I tried to render my component which contains the tinymce component with React ...
Chris's user avatar
  • 3
0 votes
1 answer
105 views

We have recently upgraded our react app to use react-18.3.1 version along with the react-hook-form latest =7.54.1, but while running test cases we started getting below error: 42 | ...
Nikhil Singh Bhadoriya's user avatar
1 vote
1 answer
845 views

import { render, screen, waitFor } from '@testing-library/react'; import React from "react"; import { createMemoryRouter, RouterProvider, Outlet, createBrowserRouter } from 'react-router-dom'...
NAVEED's user avatar
  • 127
0 votes
0 answers
81 views

I am trying to test form inputs and button clicks with the screen object from React Testing Library and getting the following error when using Jest-Cucumber with React Testing Library: ReferenceError: ...
Eric Lehmann's user avatar
0 votes
0 answers
36 views

I have a NumericFormat as part of a react-hook-form Controller which vitest renders with jest-dom. When trying to enter some test data into it, its value does not change. The Component: // ...
onouv's user avatar
  • 650
0 votes
1 answer
579 views

Say I have a listStore.js like this: import { create } from 'zustand' import queryList from '@/service' const useListStore = () => create((get, set) => ({ list: [], getList: async () =>...
Chor's user avatar
  • 1,001
-1 votes
1 answer
374 views

I am introducing tests into my project and the thing I've encountered is that when I test the whole page component MUI X Data Grid table gives a wall of errors making it almost impossible to ...
magrega's user avatar
  • 263
3 votes
2 answers
2k views

I want to learn react testing library with react-router-dom. I created the app using npx create-react-app command. The resulting code already has an App.test.js in the parent folder: import { render, ...
Petrando Richard's user avatar
0 votes
1 answer
69 views

My components are working correctly, but I need to build snapshot tests for my react project, and I can't because of this error. My data tests are running correctly. Login.jsx import React, { useState ...
Joo Victor de Aquino Netto Pac's user avatar
2 votes
0 answers
1k views

I'm creating a utility package that exports multiple tools like eslint, playwright, vitest, react testing library etc, and I'm using rollup to bundle the package. However, when I install this package ...
Prajwal Kulkarni's user avatar
2 votes
0 answers
133 views

I have the following component - "A toggle button": // ToggleButton.tsx export function ToggleButton() { const [isEnabled, setIsEnabled] = React.useState(true); return ( <button ...
Jacobdo's user avatar
  • 2,053
0 votes
1 answer
268 views

After going crazy around a test that refuses to pass, I realized that the Select component in the Antd library does not handle more than 2 options. I wrote the following test to explore the issue: ...
user2921009's user avatar
0 votes
0 answers
363 views

Hook: import { useEffect, useState } from "react"; const useIsClient = () => { const [isClient, setIsClient] = useState(false); useEffect(() => { setIsClient(true); }, []); ...
BrunoLM's user avatar
  • 101k
-1 votes
1 answer
41 views

I have a simple component like so: const MyButton = ({ onLinkClick ) => { const handleClick = e => { e.preventDefault() onLinkClick({ href: e.target.href, foo: 'bar', baz: '...
noblerare's user avatar
  • 12.1k

1
2 3 4 5
75