mirror of
https://github.com/ansible/awx.git
synced 2026-02-04 11:08:13 -03:30
update components tests to use mountWithContexts when relevant
This commit is contained in:
@@ -1,8 +1,5 @@
|
||||
import React from 'react';
|
||||
import { MemoryRouter } from 'react-router-dom';
|
||||
import { mount } from 'enzyme';
|
||||
|
||||
import { I18nProvider } from '@lingui/react';
|
||||
import { mountWithContexts } from '../enzymeHelpers';
|
||||
import PageHeaderToolbar from '../../src/components/PageHeaderToolbar';
|
||||
|
||||
describe('PageHeaderToolbar', () => {
|
||||
@@ -12,13 +9,11 @@ describe('PageHeaderToolbar', () => {
|
||||
const onLogoutClick = jest.fn();
|
||||
|
||||
test('expected content is rendered on initialization', () => {
|
||||
const wrapper = mount(
|
||||
<I18nProvider>
|
||||
<PageHeaderToolbar
|
||||
onAboutClick={onAboutClick}
|
||||
onLogoutClick={onLogoutClick}
|
||||
/>
|
||||
</I18nProvider>
|
||||
const wrapper = mountWithContexts(
|
||||
<PageHeaderToolbar
|
||||
onAboutClick={onAboutClick}
|
||||
onLogoutClick={onLogoutClick}
|
||||
/>
|
||||
);
|
||||
|
||||
expect(wrapper.find(pageHelpDropdownSelector)).toHaveLength(1);
|
||||
@@ -26,15 +21,11 @@ describe('PageHeaderToolbar', () => {
|
||||
});
|
||||
|
||||
test('dropdowns have expected items and callbacks', () => {
|
||||
const wrapper = mount(
|
||||
<MemoryRouter>
|
||||
<I18nProvider>
|
||||
<PageHeaderToolbar
|
||||
onAboutClick={onAboutClick}
|
||||
onLogoutClick={onLogoutClick}
|
||||
/>
|
||||
</I18nProvider>
|
||||
</MemoryRouter>
|
||||
const wrapper = mountWithContexts(
|
||||
<PageHeaderToolbar
|
||||
onAboutClick={onAboutClick}
|
||||
onLogoutClick={onLogoutClick}
|
||||
/>
|
||||
);
|
||||
expect(wrapper.find('DropdownItem')).toHaveLength(0);
|
||||
wrapper.find(pageHelpDropdownSelector).simulate('click');
|
||||
|
||||
Reference in New Issue
Block a user