From 0cd9a8a7d4573e130b4f9a4f7fb3fce602323716 Mon Sep 17 00:00:00 2001
From: blam
Date: Thu, 11 Jun 2020 20:42:39 +0200
Subject: [PATCH] chore(react-router-v6): tidy up parts of the PR i wasn't
happy with
---
packages/core/src/components/Button/Button.test.jsx | 4 ++--
packages/test-utils/src/testUtils/appWrappers.test.tsx | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/packages/core/src/components/Button/Button.test.jsx b/packages/core/src/components/Button/Button.test.jsx
index 5750f84101..115835be3f 100644
--- a/packages/core/src/components/Button/Button.test.jsx
+++ b/packages/core/src/components/Button/Button.test.jsx
@@ -24,7 +24,7 @@ describe('', () => {
it('navigates using react-router', async () => {
const testString = 'This is test string';
const buttonLabel = 'Navigate!';
- const { getByText, getByRole, ...all } = render(
+ const { getByText } = render(
wrapInTestApp(
{testString}
} />
@@ -34,7 +34,7 @@ describe('', () => {
);
expect(() => getByText(testString)).toThrow();
- await act(async () => fireEvent.click(getByRole('button')));
+ await act(async () => fireEvent.click(getByText(buttonLabel)));
expect(getByText(testString)).toBeInTheDocument();
});
});
diff --git a/packages/test-utils/src/testUtils/appWrappers.test.tsx b/packages/test-utils/src/testUtils/appWrappers.test.tsx
index 75fcbe4e04..19c02c2158 100644
--- a/packages/test-utils/src/testUtils/appWrappers.test.tsx
+++ b/packages/test-utils/src/testUtils/appWrappers.test.tsx
@@ -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(
- <>
+
Route 1} />
Route 2} />
- >,
- { routeEntries: ['/'] },
+ ,
+ { routeEntries: ['/route2'] },
),
);