[ARVADOS-WORKBENCH2] updated: 1.1.4-125-gf0c4e70

Git user git at public.curoverse.com
Thu Jun 21 06:35:45 EDT 2018


Summary of changes:
 .../data-explorer/data-explorer.test.tsx           | 78 ++++++++++++++++++++++
 1 file changed, 78 insertions(+)
 create mode 100644 src/components/data-explorer/data-explorer.test.tsx

       via  f0c4e703bd7bdcf90265c96d6f714bf831f6947a (commit)
      from  a21b35b41a8e69a4a1e287ce069dbc65c5c534f2 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit f0c4e703bd7bdcf90265c96d6f714bf831f6947a
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Thu Jun 21 12:35:22 2018 +0200

    Create data explorer tests
    
    Feature #13633
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/components/data-explorer/data-explorer.test.tsx b/src/components/data-explorer/data-explorer.test.tsx
new file mode 100644
index 0000000..88481ce
--- /dev/null
+++ b/src/components/data-explorer/data-explorer.test.tsx
@@ -0,0 +1,78 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import * as React from "react";
+import { mount, configure } from "enzyme";
+import * as Adapter from 'enzyme-adapter-react-16';
+
+import DataExplorer from "./data-explorer";
+import ContextMenu from "../context-menu/context-menu";
+import ColumnSelector from "../column-selector/column-selector";
+import DataTable from "../data-table/data-table";
+
+configure({ adapter: new Adapter() });
+
+describe("<DataExplorer />", () => {
+    it("communicates with <ContextMenu/>", () => {
+        const onContextAction = jest.fn();
+        const dataExplorer = mount(<DataExplorer
+            contextActions={[]}
+            onContextAction={onContextAction}
+            items={["Item 1"]}
+            columns={[{ name: "Column 1", render: jest.fn(), selected: true }]}
+            onColumnToggle={jest.fn()}
+            onFiltersChange={jest.fn()}
+            onRowClick={jest.fn()}
+            onSortToggle={jest.fn()} />);
+
+        expect(dataExplorer.find(ContextMenu).prop("actions")).toEqual([]);
+        dataExplorer.setState({ contextMenu: { item: "Item 1" } });
+        dataExplorer.find(ContextMenu).prop("onActionClick")({ name: "Action 1", icon: "" });
+        expect(onContextAction).toHaveBeenCalledWith({ name: "Action 1", icon: "" }, "Item 1");
+    });
+    
+    it("communicates with <ColumnSelector/>", () => {
+        const onColumnToggle = jest.fn();
+        const columns = [{ name: "Column 1", render: jest.fn(), selected: true }];
+        const dataExplorer = mount(<DataExplorer
+            columns={columns}
+            onColumnToggle={onColumnToggle}
+            contextActions={[]}
+            onContextAction={jest.fn()}
+            items={["Item 1"]}
+            onFiltersChange={jest.fn()}
+            onRowClick={jest.fn()}
+            onSortToggle={jest.fn()} />);
+
+        expect(dataExplorer.find(ColumnSelector).prop("columns")).toBe(columns);
+        dataExplorer.find(ColumnSelector).prop("onColumnToggle")("columns");
+        expect(onColumnToggle).toHaveBeenCalledWith("columns");
+    });
+    
+    it("communicates with <DataTable/>", () => {
+        const onFiltersChange = jest.fn();
+        const onSortToggle = jest.fn();
+        const onRowClick = jest.fn();
+        const columns = [{ name: "Column 1", render: jest.fn(), selected: true }];
+        const items = ["Item 1"];
+        const dataExplorer = mount(<DataExplorer
+            columns={columns}
+            items={items}
+            onFiltersChange={onFiltersChange}
+            onSortToggle={onSortToggle}
+            onRowClick={onRowClick}
+            onColumnToggle={jest.fn()}
+            contextActions={[]}
+            onContextAction={jest.fn()} />);
+
+        expect(dataExplorer.find(DataTable).prop("columns")).toBe(columns);
+        expect(dataExplorer.find(DataTable).prop("items")).toBe(items);
+        dataExplorer.find(DataTable).prop("onRowClick")("event", "rowClick");
+        dataExplorer.find(DataTable).prop("onFiltersChange")("filtersChange");
+        dataExplorer.find(DataTable).prop("onSortToggle")("sortToggle");
+        expect(onFiltersChange).toHaveBeenCalledWith("filtersChange");
+        expect(onSortToggle).toHaveBeenCalledWith("sortToggle");
+        expect(onRowClick).toHaveBeenCalledWith("rowClick");
+    });
+});
\ No newline at end of file

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list