Question
Can someone tell me whats wrong with this react jest testing code import React from 'react'; import * as rtl from '@testing-library/react'; import '@testing-library/jest-dom/extend-expect'; import
Can someone tell me whats wrong with this react jest testing code
import React from 'react'; import * as rtl from '@testing-library/react'; import '@testing-library/jest-dom/extend-expect'; import App from './App.js'; import PlayerList, { players } from './components/playerList.js'; afterEach(rtl.cleanup); test('renders without crashing', () => { const wrapper = rtl.render(); }); test('renders playerList to DOM', () => { const wrapper = rtl.render(); const element = wrapper.queryByText(/list of players/i); expect(element).toBeInTheDocument; }) test('renders titlebar to DOM', () => { const wrapper = rtl.render(); const element = wrapper.queryByText(/sprint/i); expect(element).toBeInTheDocument(); })
Told its something with queryByText and the wrapper but not sure. All 3 tests pass though so im not sure
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started