Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Visual Basic Net Database Programming

Authors: Rod Stephens

1st Edition

0789726815, 978-0789726810

More Books

Students also viewed these Databases questions