Fix test passing
authorDaniel Kos <daniel.kos@contractors.roche.com>
Sat, 18 Aug 2018 22:02:35 +0000 (00:02 +0200)
committerDaniel Kos <daniel.kos@contractors.roche.com>
Sat, 18 Aug 2018 22:02:35 +0000 (00:02 +0200)
Feature #13986

Arvados-DCO-1.1-Signed-off-by: Daniel Kos <daniel.kos@contractors.roche.com>

src/components/data-explorer/data-explorer.tsx
src/store/data-explorer/data-explorer-reducer.test.tsx
src/store/side-panel/side-panel-reducer.test.ts

index 1a26d5937b0f5574b921c41b302eee4bb7c415e6..af14db9c9e08818f3a9dc945718d1296f707d5e8 100644 (file)
@@ -69,7 +69,9 @@ type DataExplorerProps<T> = DataExplorerDataProps<T> & DataExplorerActionProps<T
 export const DataExplorer = withStyles(styles)(
     class DataExplorerGeneric<T> extends React.Component<DataExplorerProps<T>> {
         componentDidMount() {
-            this.props.onSetColumns(this.props.columns);
+            if (this.props.onSetColumns) {
+                this.props.onSetColumns(this.props.columns);
+            }
         }
         render() {
             const {
index 6b1c90798962032ddc273005b1f1b0c7d41de123..0bc44ba85bf06195bb34ef88500ec807c4b99e54 100644 (file)
@@ -12,9 +12,11 @@ describe('data-explorer-reducer', () => {
     it('should set columns', () => {
         const columns: DataColumns<any> = [{
             name: "Column 1",
+            filters: [],
             render: jest.fn(),
             selected: true,
-            configurable: true
+            configurable: true,
+            sortDirection: SortDirection.NONE
         }];
         const state = dataExplorerReducer(undefined,
             dataExplorerActions.SET_COLUMNS({ id: "Data explorer", columns }));
@@ -24,12 +26,14 @@ describe('data-explorer-reducer', () => {
     it('should toggle sorting', () => {
         const columns: DataColumns<any> = [{
             name: "Column 1",
+            filters: [],
             render: jest.fn(),
             selected: true,
             configurable: true,
             sortDirection: SortDirection.ASC
         }, {
             name: "Column 2",
+            filters: [],
             render: jest.fn(),
             selected: true,
             configurable: true,
@@ -44,9 +48,11 @@ describe('data-explorer-reducer', () => {
     it('should set filters', () => {
         const columns: DataColumns<any> = [{
             name: "Column 1",
+            filters: [],
             render: jest.fn(),
             selected: true,
-            configurable: true
+            configurable: true,
+            sortDirection: SortDirection.NONE
         }];
 
         const filters: DataTableFilterItem[] = [{
index 7210e1810a35d2f208bfebad5520b2c34fc35633..a76e33a49b0508e52e2a8e1cc60cadb2f7d2e97d 100644 (file)
@@ -22,7 +22,8 @@ describe('side-panel-reducer', () => {
                 id: "1",
                 name: "Projects",
                 icon: ProjectsIcon,
-                open: true
+                open: true,
+                url: "/projects"
             }
         ];