From 58d64045a181ef98d57eee6e3d965f357c672c56 Mon Sep 17 00:00:00 2001 From: "Keith J. Grant" Date: Thu, 8 Jul 2021 15:52:21 -0700 Subject: [PATCH] fix About test network call --- .../src/components/About/About.test.jsx | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/awx/ui_next/src/components/About/About.test.jsx b/awx/ui_next/src/components/About/About.test.jsx index caed85e454..683a3dbbdf 100644 --- a/awx/ui_next/src/components/About/About.test.jsx +++ b/awx/ui_next/src/components/About/About.test.jsx @@ -1,22 +1,23 @@ import React from 'react'; -import { mountWithContexts } from '../../../testUtils/enzymeHelpers'; +import { shallow } from 'enzyme'; import About from './About'; -describe('', () => { - let aboutWrapper; - let closeButton; - const onClose = jest.fn(); - test('initially renders without crashing', () => { - aboutWrapper = mountWithContexts(); - expect(aboutWrapper.length).toBe(1); - aboutWrapper.unmount(); - }); +jest.mock('../../util/useBrandName', () => ({ + __esModule: true, + default: () => ({ + current: 'AWX', + }), +})); - test('close button calls onClose handler', () => { - aboutWrapper = mountWithContexts(); - closeButton = aboutWrapper.find('AboutModalBoxCloseButton Button'); - closeButton.simulate('click'); - expect(onClose).toBeCalled(); - aboutWrapper.unmount(); +describe('', () => { + test('should render AboutModal', () => { + const onClose = jest.fn(); + const wrapper = shallow(); + + 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); }); });