December 2019
Intermediate to advanced
598 pages
12h 21m
English
Carry out the following steps to test that the Question component renders correctly:
import React from 'react';import { render, cleanup } from '@testing-library/react';import { QuestionData } from './QuestionsData';import { Question } from './Question';import { BrowserRouter } from 'react-router-dom';afterEach(cleanup);test('When the Question component is rendered, it should contain the correct data', () => { });
This imports all the items we need for our test. We have also implemented the cleanup function, which will run after the test.
test('When the Question component is rendered, ...Read now
Unlock full access