diff --git a/awx/ui_next/src/components/Schedule/shared/ScheduleForm.test.jsx b/awx/ui_next/src/components/Schedule/shared/ScheduleForm.test.jsx index a1f0573192..4891d337f6 100644 --- a/awx/ui_next/src/components/Schedule/shared/ScheduleForm.test.jsx +++ b/awx/ui_next/src/components/Schedule/shared/ScheduleForm.test.jsx @@ -730,10 +730,6 @@ describe('', () => { ); }); - await act(async () => { - wrapper.find('DatePicker[aria-label="End date"]').simulate('blur'); - }); - wrapper.update(); expect(wrapper.find('#schedule-End-datetime-helper').text()).toBe( 'Please select an end date/time that comes after the start date/time.' diff --git a/awx/ui_next/src/setupTests.js b/awx/ui_next/src/setupTests.js index 12d8dafcd9..e57552f6f6 100644 --- a/awx/ui_next/src/setupTests.js +++ b/awx/ui_next/src/setupTests.js @@ -14,8 +14,9 @@ require('@nteract/mockument'); // eslint-disable-next-line import/prefer-default-export export const asyncFlush = () => new Promise(resolve => setImmediate(resolve)); -let consoleHasError = false; -const { error } = global.console; +let hasConsoleError = false; +let hasConsoleWarn = false; +const { error, warn } = global.console; global.console = { ...console, @@ -25,16 +26,24 @@ global.console = { // fail tests that log errors. // adapted from https://github.com/facebook/jest/issues/6121#issuecomment-708330601 error: (...args) => { - consoleHasError = true; + hasConsoleError = true; error(...args); }, + warn: (...args) => { + hasConsoleWarn = true; + warn(...args); + }, }; afterEach(() => { - if (consoleHasError) { - consoleHasError = false; + if (hasConsoleError) { + hasConsoleError = false; throw new Error('Error logged to console'); } + if (hasConsoleWarn) { + hasConsoleWarn = false; + throw new Error('Warning logged to console'); + } }); // This global variable is part of our Content Security Policy framework diff --git a/awx/ui_next/testUtils/enzymeHelpers.jsx b/awx/ui_next/testUtils/enzymeHelpers.jsx index 18deb63e0e..5d2a944677 100644 --- a/awx/ui_next/testUtils/enzymeHelpers.jsx +++ b/awx/ui_next/testUtils/enzymeHelpers.jsx @@ -61,6 +61,7 @@ const defaultContexts = { session: { isSessionExpired: false, logout: () => {}, + setAuthRedirectTo: () => {}, }, };