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
Get step-by-step solutions from verified subject matter experts
