From 62e947d7007629b63e86f1faef892a453dfb7c83 Mon Sep 17 00:00:00 2001 From: fahad Date: Sat, 24 Jul 2021 19:12:33 +0600 Subject: [PATCH] docs: fix react-router-example test-case(#897) *docs: update example-react-route.mdx *docs: replace createMemoryHistory with MemoryRouter for first test-case --- docs/example-react-router.mdx | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/docs/example-react-router.mdx b/docs/example-react-router.mdx index 2c20c1a1..8df0f961 100644 --- a/docs/example-react-router.mdx +++ b/docs/example-react-router.mdx @@ -49,19 +49,14 @@ import {render, screen} from '@testing-library/react' import userEvent from '@testing-library/user-event' import {createMemoryHistory} from 'history' import React from 'react' -import {Router} from 'react-router-dom' +import {Router, MemoryRouter} from 'react-router-dom' import '@testing-library/jest-dom/extend-expect' import {App, LocationDisplay} from './app' test('full app rendering/navigating', () => { - const history = createMemoryHistory() - render( - - - , - ) + render(, {wrapper: MemoryRouter}) // verify page content for expected route // often you'd use a data-testid or role query, but this is also possible expect(screen.getByText(/you are home/i)).toBeInTheDocument()