chore(react-router-v6): tidy up parts of the PR i wasn't happy with

This commit is contained in:
blam
2020-06-11 20:42:39 +02:00
parent 273db0314a
commit 0cd9a8a7d4
2 changed files with 6 additions and 6 deletions
@@ -24,7 +24,7 @@ describe('<Button />', () => {
it('navigates using react-router', async () => {
const testString = 'This is test string';
const buttonLabel = 'Navigate!';
const { getByText, getByRole, ...all } = render(
const { getByText } = render(
wrapInTestApp(
<Routes>
<Route path="/test" element={<p>{testString}</p>} />
@@ -34,7 +34,7 @@ describe('<Button />', () => {
);
expect(() => getByText(testString)).toThrow();
await act(async () => fireEvent.click(getByRole('button')));
await act(async () => fireEvent.click(getByText(buttonLabel)));
expect(getByText(testString)).toBeInTheDocument();
});
});
@@ -17,7 +17,7 @@
import React, { FC, useEffect } from 'react';
import { render } from '@testing-library/react';
import { wrapInTestApp, renderInTestApp } from './appWrappers';
import { Route } from 'react-router';
import { Route, Routes } from 'react-router';
import { withLogCollector } from '@backstage/test-utils-core';
import {
useApi,
@@ -32,11 +32,11 @@ describe('wrapInTestApp', () => {
const { error } = await withLogCollector(['error'], async () => {
const rendered = render(
wrapInTestApp(
<>
<Routes>
<Route path="/route1" element={<p>Route 1</p>} />
<Route path="/route2" element={<p>Route 2</p>} />
</>,
{ routeEntries: ['/'] },
</Routes>,
{ routeEntries: ['/route2'] },
),
);