mirror of
https://github.com/ansible/awx.git
synced 2026-05-11 03:17:38 -02:30
fix About test network call
This commit is contained in:
@@ -1,22 +1,23 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { mountWithContexts } from '../../../testUtils/enzymeHelpers';
|
import { shallow } from 'enzyme';
|
||||||
import About from './About';
|
import About from './About';
|
||||||
|
|
||||||
describe('<About />', () => {
|
jest.mock('../../util/useBrandName', () => ({
|
||||||
let aboutWrapper;
|
__esModule: true,
|
||||||
let closeButton;
|
default: () => ({
|
||||||
const onClose = jest.fn();
|
current: 'AWX',
|
||||||
test('initially renders without crashing', () => {
|
}),
|
||||||
aboutWrapper = mountWithContexts(<About isOpen onClose={onClose} />);
|
}));
|
||||||
expect(aboutWrapper.length).toBe(1);
|
|
||||||
aboutWrapper.unmount();
|
|
||||||
});
|
|
||||||
|
|
||||||
test('close button calls onClose handler', () => {
|
describe('<About />', () => {
|
||||||
aboutWrapper = mountWithContexts(<About isOpen onClose={onClose} />);
|
test('should render AboutModal', () => {
|
||||||
closeButton = aboutWrapper.find('AboutModalBoxCloseButton Button');
|
const onClose = jest.fn();
|
||||||
closeButton.simulate('click');
|
const wrapper = shallow(<About isOpen onClose={onClose} />);
|
||||||
expect(onClose).toBeCalled();
|
|
||||||
aboutWrapper.unmount();
|
const modal = wrapper.find('AboutModal');
|
||||||
|
expect(modal).toHaveLength(1);
|
||||||
|
expect(modal.prop('onClose')).toEqual(onClose);
|
||||||
|
expect(modal.prop('productName')).toEqual('Ansible AWX');
|
||||||
|
expect(modal.prop('isOpen')).toEqual(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user