From b3a2c8455603e6a8de0c8f06e12025e270ecbc6e Mon Sep 17 00:00:00 2001 From: Josh Black Date: Mon, 27 Jan 2020 16:53:48 -0600 Subject: [PATCH] chore(project): add setup for test failure with unexpected console (#5184) * chore(project): add setup for test failure with unexpected console * chore(components): update timeout for styles-test.js * test(checkbox): add missing required props * test(data-table): add missing or required props * test(ui-shell): update tests and add missing props * test(overflow-menu): add missing props * test(number-input): skip test with invalid prop * test(date-picker): update mocks of console.error * test(tag): add missing props * Update packages/components/tests/styles-test.js Co-authored-by: TJ Egan --- packages/components/tests/styles-test.js | 2 +- .../src/components/Checkbox/Checkbox-test.js | 9 ++- .../DataTable/__tests__/DataTable-test.js | 7 ++- .../__tests__/TableBatchAction-test.js | 6 +- .../__tests__/TableExpandHeader-test.js | 7 ++- .../__tests__/TableExpandRow-test.js | 8 +-- .../__tests__/TableToolbarMenu-test.js | 9 ++- .../__snapshots__/DataTable-test.js.snap | 8 +-- .../TableBatchAction-test.js.snap | 8 ++- .../TableExpandHeader-test.js.snap | 3 + .../__snapshots__/TableExpandRow-test.js.snap | 12 +++- .../components/DatePicker/DatePicker-test.js | 19 ++++++- .../NumberInput/NumberInput-test.js | 3 +- .../OverflowMenu/OverflowMenu-test.js | 19 ++++--- .../OverflowMenuItem/OverflowMenuItem-test.js | 3 +- packages/react/src/components/Tag/Tag-test.js | 10 +++- .../UIShell/__tests__/SideNavFooter-test.js | 2 +- .../UIShell/__tests__/SideNavItems-test.js | 4 +- .../UIShell/__tests__/SideNavMenu-test.js | 20 +++++-- .../__snapshots__/SideNavFooter-test.js.snap | 3 +- .../__snapshots__/SideNavItems-test.js.snap | 10 +++- tasks/jest/setupAfterEnv.js | 56 +++++++++++++++++++ 22 files changed, 177 insertions(+), 51 deletions(-) diff --git a/packages/components/tests/styles-test.js b/packages/components/tests/styles-test.js index 7660f3eb8de8..642def1aa5d7 100644 --- a/packages/components/tests/styles-test.js +++ b/packages/components/tests/styles-test.js @@ -22,7 +22,7 @@ const files = glob.sync('**/*.scss', { const render = promisify(sass.render); describe('styles', () => { - jest.setTimeout(8000); + jest.setTimeout(20000); it.each(files)('%s should compile', async relativeFilePath => { const filepath = path.join(cwd, relativeFilePath); try { diff --git a/packages/react/src/components/Checkbox/Checkbox-test.js b/packages/react/src/components/Checkbox/Checkbox-test.js index abdd198c4e9c..f1d257704396 100644 --- a/packages/react/src/components/Checkbox/Checkbox-test.js +++ b/packages/react/src/components/Checkbox/Checkbox-test.js @@ -144,7 +144,14 @@ describe('refs', () => { this.myRef = React.createRef(); } render() { - return ; + return ( + + ); } } const wrapper = mount(); diff --git a/packages/react/src/components/DataTable/__tests__/DataTable-test.js b/packages/react/src/components/DataTable/__tests__/DataTable-test.js index e042bc7f96d2..324f55ec14cc 100644 --- a/packages/react/src/components/DataTable/__tests__/DataTable-test.js +++ b/packages/react/src/components/DataTable/__tests__/DataTable-test.js @@ -113,7 +113,7 @@ describe('DataTable', () => { Action 3 - @@ -400,7 +400,7 @@ describe('DataTable', () => { Action 3 - @@ -689,6 +689,7 @@ describe('DataTable', () => { rows, headers, getHeaderProps, + getExpandHeaderProps, getSelectionProps, getBatchActionProps, getRowProps, @@ -704,7 +705,7 @@ describe('DataTable', () => { - + {headers.map(header => ( diff --git a/packages/react/src/components/DataTable/__tests__/TableBatchAction-test.js b/packages/react/src/components/DataTable/__tests__/TableBatchAction-test.js index afd58a564609..79bf7c9ff602 100644 --- a/packages/react/src/components/DataTable/__tests__/TableBatchAction-test.js +++ b/packages/react/src/components/DataTable/__tests__/TableBatchAction-test.js @@ -11,7 +11,9 @@ import { TableBatchAction } from '../'; describe('DataTable.TableBatchAction', () => { it('should render', () => { - const wrapper = mount(); + const wrapper = mount( + + ); expect(wrapper).toMatchSnapshot(); }); @@ -21,7 +23,7 @@ describe('DataTable.TableBatchAction', () => { )); - mount(); + mount(); expect(renderIcon).toHaveBeenCalled(); }); }); diff --git a/packages/react/src/components/DataTable/__tests__/TableExpandHeader-test.js b/packages/react/src/components/DataTable/__tests__/TableExpandHeader-test.js index b19d0d5a9bcb..065a8ff1f189 100644 --- a/packages/react/src/components/DataTable/__tests__/TableExpandHeader-test.js +++ b/packages/react/src/components/DataTable/__tests__/TableExpandHeader-test.js @@ -15,7 +15,12 @@ describe('DataTable.TableExpandHeader', () => {
- +
diff --git a/packages/react/src/components/DataTable/__tests__/TableExpandRow-test.js b/packages/react/src/components/DataTable/__tests__/TableExpandRow-test.js index 9ef0271bec98..224f43560dcd 100644 --- a/packages/react/src/components/DataTable/__tests__/TableExpandRow-test.js +++ b/packages/react/src/components/DataTable/__tests__/TableExpandRow-test.js @@ -26,7 +26,7 @@ describe('DataTable.TableExpandRow', () => { - +
); @@ -38,7 +38,7 @@ describe('DataTable.TableExpandRow', () => { - +
); @@ -63,7 +63,7 @@ describe('DataTable.TableExpandRow', () => { - +
); @@ -74,7 +74,7 @@ describe('DataTable.TableExpandRow', () => { - +
); diff --git a/packages/react/src/components/DataTable/__tests__/TableToolbarMenu-test.js b/packages/react/src/components/DataTable/__tests__/TableToolbarMenu-test.js index f03bac6b52b5..f93268df9952 100644 --- a/packages/react/src/components/DataTable/__tests__/TableToolbarMenu-test.js +++ b/packages/react/src/components/DataTable/__tests__/TableToolbarMenu-test.js @@ -16,8 +16,9 @@ describe('DataTable.TableToolbarMenu', () => { + iconDescription="Add"> + test + ); expect(wrapper).toMatchSnapshot(); }); @@ -26,7 +27,9 @@ describe('DataTable.TableToolbarMenu', () => { describe('Custom icon in DataTable.TableToolbarMenu', () => { it('should render', () => { const iconAction = mount( - + + test + ); const originalIcon = mount().find('svg'); const icon = iconAction.find('svg'); diff --git a/packages/react/src/components/DataTable/__tests__/__snapshots__/DataTable-test.js.snap b/packages/react/src/components/DataTable/__tests__/__snapshots__/DataTable-test.js.snap index c8d73a27a9b5..8d3d08bae1b7 100644 --- a/packages/react/src/components/DataTable/__tests__/__snapshots__/DataTable-test.js.snap +++ b/packages/react/src/components/DataTable/__tests__/__snapshots__/DataTable-test.js.snap @@ -1851,7 +1851,7 @@ exports[`DataTable should render 1`] = ` disabled={false} kind="primary" onClick={[MockFunction]} - small={true} + size="small" tabIndex={0} type="button" > @@ -2456,7 +2456,7 @@ exports[`DataTable should render 1`] = ` disabled={false} kind="primary" onClick={[MockFunction]} - small={true} + size="small" tabIndex={0} type="button" > @@ -2830,7 +2830,7 @@ exports[`DataTable sticky header should render 1`] = ` disabled={false} kind="primary" onClick={[MockFunction]} - small={true} + size="small" tabIndex={0} type="button" > @@ -3438,7 +3438,7 @@ exports[`DataTable sticky header should render 1`] = ` disabled={false} kind="primary" onClick={[MockFunction]} - small={true} + size="small" tabIndex={0} type="button" > diff --git a/packages/react/src/components/DataTable/__tests__/__snapshots__/TableBatchAction-test.js.snap b/packages/react/src/components/DataTable/__tests__/__snapshots__/TableBatchAction-test.js.snap index 7a10c18a6d88..6fcfa03bbf0d 100644 --- a/packages/react/src/components/DataTable/__tests__/__snapshots__/TableBatchAction-test.js.snap +++ b/packages/react/src/components/DataTable/__tests__/__snapshots__/TableBatchAction-test.js.snap @@ -3,6 +3,7 @@ exports[`DataTable.TableBatchAction should render 1`] = `