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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!