fix About test network call

This commit is contained in:
Keith J. Grant
2021-07-08 15:52:21 -07:00
parent 0e12c7deb4
commit 58d64045a1

View File

@@ -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);
}); });
}); });