From 8557dda8eb03602b6cbb6f61800acf7effe5feed Mon Sep 17 00:00:00 2001 From: Kirill Kharitonov Date: Wed, 31 Jan 2024 19:18:32 +0300 Subject: [PATCH] test: removed snapshot Table tests --- .../Table/__tests__/Table.hocs.test.ts | 41 --- src/components/Table/__tests__/Table.test.tsx | 69 ---- .../__snapshots__/Table.hocs.test.ts.snap | 300 ----------------- .../__snapshots__/Table.test.tsx.snap | 311 ------------------ 4 files changed, 721 deletions(-) delete mode 100644 src/components/Table/__tests__/__snapshots__/Table.hocs.test.ts.snap delete mode 100644 src/components/Table/__tests__/__snapshots__/Table.test.tsx.snap diff --git a/src/components/Table/__tests__/Table.hocs.test.ts b/src/components/Table/__tests__/Table.hocs.test.ts index d6d858122e..b6c3853615 100644 --- a/src/components/Table/__tests__/Table.hocs.test.ts +++ b/src/components/Table/__tests__/Table.hocs.test.ts @@ -24,47 +24,6 @@ function getTextContent(html = '') { } describe('Table HOCs tests', () => { - it('withTableActions should match snapshot', () => { - const Table1 = withTableActions(Table); - - type Props = TableProps & WithTableActionsProps; - const props: Props = { - data: [{disabled: false}, {disabled: true}], - columns: [{id: 'name'}], - isRowDisabled: ({disabled}) => disabled, - getRowActions: () => [], - }; - const {container} = render(React.createElement(Table1, props)); - - expect(container).toMatchSnapshot(); - }); - - it('all HOCs should match snapshot', () => { - const Table1 = withTableSorting( - withTableSettings(withTableCopy(withTableActions(withTableSelection(Table)))), - ); - - type Props = TableProps & - WithTableActionsProps & - WithTableSelectionProps & - WithTableSettingsProps & - WithTableSortingProps; - - const props: Props = { - data: [{disabled: false}, {disabled: true}], - columns: [{id: 'name'}], - isRowDisabled: ({disabled}) => disabled, - selectedIds: [], - onSelectionChange: () => {}, - getRowActions: () => [], - updateSettings: () => Promise.resolve(), - settings: [], - }; - const {container} = render(React.createElement(Table1, props)); - - expect(container).toMatchSnapshot(); - }); - it('using withTableActions and withTableSelection should not depend of order', () => { const Table1 = withTableActions(withTableSelection(Table)); const Table2 = withTableSelection(withTableActions(Table)); diff --git a/src/components/Table/__tests__/Table.test.tsx b/src/components/Table/__tests__/Table.test.tsx index db8ed9cf9c..a342fec7ce 100644 --- a/src/components/Table/__tests__/Table.test.tsx +++ b/src/components/Table/__tests__/Table.test.tsx @@ -19,75 +19,6 @@ describe('Table', () => { expect(rows.length).toBe(data.length + 1); }); - test('should render empty state', () => { - const props: TableProps = {data: [], columns: [{id: 'name'}]}; - const {container} = render(React.createElement>(Table, props)); - - expect(container).toMatchSnapshot(); - }); - - test('should correctly apply `align` prop', () => { - const props: TableProps<{}> = { - data: [{}], - columns: [ - {id: 'name1', align: 'left'}, - {id: 'name2', align: 'right'}, - {id: 'name3', align: 'center'}, - ], - }; - const {container} = render(React.createElement>(Table, props)); - - expect(container).toMatchSnapshot(); - }); - - test('should correctly apply `width` prop', () => { - const props: TableProps<{}> = { - data: [{}], - columns: [ - {id: 'name1', width: 100}, - {id: 'name2', width: 200}, - {id: 'name3', width: 300}, - ], - }; - const {container} = render(React.createElement>(Table, props)); - - expect(container).toMatchSnapshot(); - }); - - test('should correctly apply `primary` prop', () => { - const props: TableProps<{}> = { - data: [{}], - columns: [{id: 'name1', primary: true}, {id: 'name2', primary: false}, {id: 'name3'}], - }; - const {container} = render(React.createElement>(Table, props)); - - expect(container).toMatchSnapshot(); - }); - - test('should correctly add custom row classnames', () => { - const props: TableProps<{}> = { - data: [{}], - columns: [{id: 'name'}], - getRowClassNames: () => ['custom-row', 'custom-row_mod'], - }; - const {container} = render(React.createElement>(Table, props)); - - expect(container).toMatchSnapshot(); - }); - - test('should correctly add disabled classname', () => { - const props: TableProps<{disabled: boolean}> = { - data: [{disabled: false}, {disabled: true}], - columns: [{id: 'name'}], - isRowDisabled: ({disabled}) => disabled, - }; - const {container} = render( - React.createElement>(Table, props), - ); - - expect(container).toMatchSnapshot(); - }); - test.each(new Array<'top' | 'middle'>('top', 'middle'))( 'render with given "%s" vertical align', (align) => { diff --git a/src/components/Table/__tests__/__snapshots__/Table.hocs.test.ts.snap b/src/components/Table/__tests__/__snapshots__/Table.hocs.test.ts.snap deleted file mode 100644 index 8260ca57d9..0000000000 --- a/src/components/Table/__tests__/__snapshots__/Table.hocs.test.ts.snap +++ /dev/null @@ -1,300 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Table HOCs tests all HOCs should match snapshot 1`] = ` -
-
- - - - - - - - - - - - - - - - - - -
- - - name - -
-
-
- -
-
-
-
- - - — - -
- - - — - -
-
-
-`; - -exports[`Table HOCs tests withTableActions should match snapshot 1`] = ` -
-
- - - - - - - - - - - - - - -
- name - -
- — - -
- — - -
-
-
-`; diff --git a/src/components/Table/__tests__/__snapshots__/Table.test.tsx.snap b/src/components/Table/__tests__/__snapshots__/Table.test.tsx.snap deleted file mode 100644 index 4bb5d4b58a..0000000000 --- a/src/components/Table/__tests__/__snapshots__/Table.test.tsx.snap +++ /dev/null @@ -1,311 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Table should correctly add custom row classnames 1`] = ` -
-
- - - - - - - - - - - -
- name -
- — -
-
-
-`; - -exports[`Table should correctly add disabled classname 1`] = ` -
-
- - - - - - - - - - - - - - -
- name -
- — -
- — -
-
-
-`; - -exports[`Table should correctly apply \`align\` prop 1`] = ` -
-
- - - - - - - - - - - - - - - -
- name1 - - name2 - - name3 -
- — - - — - - — -
-
-
-`; - -exports[`Table should correctly apply \`primary\` prop 1`] = ` -
-
- - - - - - - - - - - - - - - -
- name1 - - name2 - - name3 -
- — - - — - - — -
-
-
-`; - -exports[`Table should correctly apply \`width\` prop 1`] = ` -
-
- - - - - - - - - - - - - - - -
- name1 - - name2 - - name3 -
- — - - — - - — -
-
-
-`; - -exports[`Table should render empty state 1`] = ` -
-
- - - - - - - - - - - -
- name -
- No data -
-
-
-`;