From f9d615fdee7e8f55bbdd1e33b9bf8b415a2f3121 Mon Sep 17 00:00:00 2001 From: kialam Date: Tue, 19 Feb 2019 11:28:17 -0500 Subject: [PATCH] Fix unit tests. --- __tests__/components/AnsibleSelect.test.jsx | 13 ------- .../screens/OrganizationAdd.test.jsx | 34 +++++++++++++++++++ 2 files changed, 34 insertions(+), 13 deletions(-) diff --git a/__tests__/components/AnsibleSelect.test.jsx b/__tests__/components/AnsibleSelect.test.jsx index 8f54b0d522..c80207cc9d 100644 --- a/__tests__/components/AnsibleSelect.test.jsx +++ b/__tests__/components/AnsibleSelect.test.jsx @@ -33,19 +33,6 @@ describe('', () => { expect(spy).toHaveBeenCalled(); }); - test('content not rendered when data property is falsey', () => { - const wrapper = mount( - { }} - label={label} - data={null} - /> - ); - expect(wrapper.find('FormGroup')).toHaveLength(0); - expect(wrapper.find('Select')).toHaveLength(0); - }); test('Returns correct select options if defaultSelected props is passed', () => { const wrapper = mount( ', () => { @@ -157,4 +158,37 @@ describe('', () => { }); expect(createInstanceGroupsFn).toHaveBeenCalledWith('/api/v2/organizations/1/instance_groups', 1); }); + + test('AnsibleSelect component renders if there are virtual environments', () => { + const config = { + custom_virtualenvs: ['foo', 'bar'], + }; + const wrapper = mount( + + + + + + + + ).find('OrganizationAdd').find('AnsibleSelect'); + expect(wrapper.find('Select')).toHaveLength(1); + expect(wrapper.find('SelectOption')).toHaveLength(2); + }); + + test('AnsibleSelect component does not render if there are 0 virtual environments', () => { + const config = { + custom_virtualenvs: [], + }; + const wrapper = mount( + + + + + + + + ).find('OrganizationAdd').find('AnsibleSelect'); + expect(wrapper.find('Select')).toHaveLength(0); + }); });