From 1471945b9eebe52fa785c8da106c66783a6fa59e Mon Sep 17 00:00:00 2001 From: nixocio Date: Wed, 28 Apr 2021 08:56:10 -0400 Subject: [PATCH] Fix a few unit-tests warnings Fix a few unit-test warnings --- awx/ui_next/.eslintrc | 3 +- .../ScheduleEdit/ScheduleEdit.test.jsx | 2 +- .../Credential/shared/CredentialForm.jsx | 2 +- .../InventoryDetail/InventoryDetail.test.jsx | 13 ++++----- awx/ui_next/src/screens/Login/Login.jsx | 28 +++++++++---------- .../src/screens/Metrics/Metrics.test.jsx | 2 +- 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/awx/ui_next/.eslintrc b/awx/ui_next/.eslintrc index 90c96ae87b..94500c2691 100644 --- a/awx/ui_next/.eslintrc +++ b/awx/ui_next/.eslintrc @@ -81,7 +81,8 @@ "gridColumns", "rows", "href", - "modifier" + "modifier", + "data-cy" ], "ignore": ["Ansible", "Tower", "JSON", "YAML", "lg"], "ignoreComponent": [ diff --git a/awx/ui_next/src/components/Schedule/ScheduleEdit/ScheduleEdit.test.jsx b/awx/ui_next/src/components/Schedule/ScheduleEdit/ScheduleEdit.test.jsx index 2f1f2fe85b..02a73db2be 100644 --- a/awx/ui_next/src/components/Schedule/ScheduleEdit/ScheduleEdit.test.jsx +++ b/awx/ui_next/src/components/Schedule/ScheduleEdit/ScheduleEdit.test.jsx @@ -136,7 +136,7 @@ describe('', () => { resource={{ id: 700, type: 'job_template', - iventory: 1, + inventory: 1, summary_fields: { credentials: [ { name: 'job template credential', id: 75, kind: 'ssh' }, diff --git a/awx/ui_next/src/screens/Credential/shared/CredentialForm.jsx b/awx/ui_next/src/screens/Credential/shared/CredentialForm.jsx index 25ae4ac23a..3e76a34234 100644 --- a/awx/ui_next/src/screens/Credential/shared/CredentialForm.jsx +++ b/awx/ui_next/src/screens/Credential/shared/CredentialForm.jsx @@ -157,7 +157,7 @@ function CredentialFormFields({ i18n, initialTypeId, credentialTypes }) { {credType.label} diff --git a/awx/ui_next/src/screens/Inventory/InventoryDetail/InventoryDetail.test.jsx b/awx/ui_next/src/screens/Inventory/InventoryDetail/InventoryDetail.test.jsx index fd36b84877..c40021e35d 100644 --- a/awx/ui_next/src/screens/Inventory/InventoryDetail/InventoryDetail.test.jsx +++ b/awx/ui_next/src/screens/Inventory/InventoryDetail/InventoryDetail.test.jsx @@ -90,14 +90,13 @@ describe('', () => { expectDetailToMatch(wrapper, 'Name', mockInventory.name); expectDetailToMatch(wrapper, 'Description', mockInventory.description); expectDetailToMatch(wrapper, 'Type', 'Inventory'); + const link = wrapper.find('Detail[label="Organization"]').find('Link'); + const org = wrapper.find('Detail[label="Organization"]'); - expect(org.prop('value')).toMatchInlineSnapshot(` - - The Organization - - `); + + expect(link.prop('to')).toEqual('/organizations/1/details'); + expect(org.length).toBe(1); + const vars = wrapper.find('VariablesDetail'); expect(vars).toHaveLength(1); expect(vars.prop('value')).toEqual(mockInventory.variables); diff --git a/awx/ui_next/src/screens/Login/Login.jsx b/awx/ui_next/src/screens/Login/Login.jsx index d23c0f4f82..7448eccfd0 100644 --- a/awx/ui_next/src/screens/Login/Login.jsx +++ b/awx/ui_next/src/screens/Login/Login.jsx @@ -131,12 +131,12 @@ function AWXLogin({ alt, i18n, isAuthenticated }) { } const HeaderBrand = ( - + ); const Header = ; const Footer = ( {formik => ( {i18n._( t`Failed to fetch custom login configuration settings. System defaults will be shown instead.` @@ -211,7 +211,7 @@ function AWXLogin({ alt, i18n, isAuthenticated }) { if (authKey === 'azuread-oauth2') { return ( @@ -224,7 +224,7 @@ function AWXLogin({ alt, i18n, isAuthenticated }) { if (authKey === 'github') { return ( @@ -237,7 +237,7 @@ function AWXLogin({ alt, i18n, isAuthenticated }) { if (authKey === 'github-org') { return ( @@ -252,7 +252,7 @@ function AWXLogin({ alt, i18n, isAuthenticated }) { if (authKey === 'github-team') { return ( @@ -265,7 +265,7 @@ function AWXLogin({ alt, i18n, isAuthenticated }) { if (authKey === 'github-enterprise') { return ( @@ -280,7 +280,7 @@ function AWXLogin({ alt, i18n, isAuthenticated }) { if (authKey === 'github-enterprise-org') { return ( @@ -297,7 +297,7 @@ function AWXLogin({ alt, i18n, isAuthenticated }) { if (authKey === 'github-enterprise-team') { return ( @@ -314,7 +314,7 @@ function AWXLogin({ alt, i18n, isAuthenticated }) { if (authKey === 'google-oauth2') { return ( @@ -328,7 +328,7 @@ function AWXLogin({ alt, i18n, isAuthenticated }) { const samlIDP = authKey.split(':')[1] || null; return ( diff --git a/awx/ui_next/src/screens/Metrics/Metrics.test.jsx b/awx/ui_next/src/screens/Metrics/Metrics.test.jsx index 709196d703..b317e2e568 100644 --- a/awx/ui_next/src/screens/Metrics/Metrics.test.jsx +++ b/awx/ui_next/src/screens/Metrics/Metrics.test.jsx @@ -53,7 +53,7 @@ describe('', () => { .prop('onClick')({}, 'instance 1'); }); wrapper.update(); - await act(() => { + await act(async () => { wrapper.find('Select[ouiaId="Metric-select"]').prop('onToggle')(true); }); wrapper.update();