Fix test passing
authorDaniel Kos <daniel.kos@contractors.roche.com>
Wed, 2 Jan 2019 08:28:10 +0000 (09:28 +0100)
committerDaniel Kos <daniel.kos@contractors.roche.com>
Wed, 2 Jan 2019 08:28:10 +0000 (09:28 +0100)
No issue #

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

src/components/data-explorer/data-explorer.test.tsx
src/store/data-explorer/data-explorer-middleware.test.ts

index d74b5319d789b743bfa6878bd6e359839cdbe16d..1d8738abb1e29bcb3207efa755a6f3e1f1bb4fc8 100644 (file)
@@ -8,11 +8,10 @@ import * as Adapter from 'enzyme-adapter-react-16';
 
 import { DataExplorer } from "./data-explorer";
 import { ColumnSelector } from "../column-selector/column-selector";
-import { DataTable } from "../data-table/data-table";
+import { DataTable, DataTableFetchMode } from "../data-table/data-table";
 import { SearchInput } from "../search-input/search-input";
 import { TablePagination } from "@material-ui/core";
 import { ProjectIcon } from '../icon/icon';
-import { DefaultView } from '../default-view/default-view';
 import { SortDirection } from '../data-table/data-column';
 
 configure({ adapter: new Adapter() });
@@ -36,7 +35,7 @@ describe("<DataExplorer />", () => {
     it("communicates with <ColumnSelector/>", () => {
         const onColumnToggle = jest.fn();
         const onSetColumns = jest.fn();
-        const columns = [{ name: "Column 1", render: jest.fn(), selected: true, configurable: true, sortDirection: SortDirection.ASC, filters: [] }];
+        const columns = [{ name: "Column 1", render: jest.fn(), selected: true, configurable: true, sortDirection: SortDirection.ASC, filters: {} }];
         const dataExplorer = mount(<DataExplorer
             {...mockDataExplorerProps()}
             columns={columns}
@@ -53,7 +52,7 @@ describe("<DataExplorer />", () => {
         const onSortToggle = jest.fn();
         const onRowClick = jest.fn();
         const onSetColumns = jest.fn();
-        const columns = [{ name: "Column 1", render: jest.fn(), selected: true, configurable: true, sortDirection: SortDirection.ASC, filters: [] }];
+        const columns = [{ name: "Column 1", render: jest.fn(), selected: true, configurable: true, sortDirection: SortDirection.ASC, filters: {} }];
         const items = [{ name: "item 1" }];
         const dataExplorer = mount(<DataExplorer
             {...mockDataExplorerProps()}
@@ -95,6 +94,7 @@ describe("<DataExplorer />", () => {
 });
 
 const mockDataExplorerProps = () => ({
+    fetchMode: DataTableFetchMode.PAGINATED,
     columns: [],
     items: [],
     itemsAvailable: 0,
@@ -114,6 +114,7 @@ const mockDataExplorerProps = () => ({
     onContextMenu: jest.fn(),
     defaultIcon: ProjectIcon,
     onSetColumns: jest.fn(),
+    onLoadMore: jest.fn(),
     defaultMessages: ['testing'],
     contextMenuColumn: true
 });
index 00931bf8e3c95cd5d98404ac74a14b136253536a..5d729ce2d600290cb2f9d05acb268db861ad9eba 100644 (file)
@@ -38,7 +38,7 @@ describe("DataExplorerMiddleware", () => {
         middleware(dataExplorerActions.SET_PAGE({ id: "OtherId", page: 0 }));
         middleware(dataExplorerActions.SET_PAGE({ id: "ServiceId", page: 0 }));
         middleware(dataExplorerActions.SET_PAGE({ id: "OtherId", page: 0 }));
-        expect(api.dispatch).toHaveBeenCalledWith(dataExplorerActions.REQUEST_ITEMS({ id: "ServiceId" }));
+        expect(api.dispatch).toHaveBeenCalledWith(dataExplorerActions.REQUEST_ITEMS({ id: "ServiceId", criteriaChanged: false }));
         expect(api.dispatch).toHaveBeenCalledTimes(1);
     });