webpack/components/RoutedTabs/__tests__/RoutedTabs.test.js in katello-4.2.2 vs webpack/components/RoutedTabs/__tests__/RoutedTabs.test.js in katello-4.3.0.rc1
- old
+ new
@@ -1,32 +1,26 @@
import React from 'react';
import { renderWithRouter } from 'react-testing-lib-wrapper';
+import { head } from 'lodash';
import RoutedTabs from '../';
const tabs = [
{
key: 'apples',
title: 'Apples',
content: <>good for pies!</>,
+ path: '/fruits',
},
{
key: 'pears',
title: 'Pears',
content: <>good for a snack!</>,
+ path: '/fruits',
},
];
test('can render tabs and show default tab', async () => {
- const { getByText } = renderWithRouter(<RoutedTabs tabs={tabs} baseUrl="/fruits" defaultTabIndex={1} />);
-
- expect(getByText('Pears')).toBeInTheDocument();
- expect(getByText('good for a snack!')).toBeInTheDocument();
-});
-
-test('can switch tabs and render content', async () => {
- const { getByText } = renderWithRouter(<RoutedTabs tabs={tabs} baseUrl="/fruits" />);
-
- expect(getByText('good for pies!')).toBeInTheDocument();
- getByText('Pears').click();
+ const { getAllByLabelText, getByText } = renderWithRouter(<RoutedTabs tabs={tabs} baseUrl="/fruits" defaultTabIndex={1} />);
+ expect(head(getAllByLabelText('Pears'))).toBeInTheDocument();
expect(getByText('good for a snack!')).toBeInTheDocument();
});