[ARVADOS-WORKBENCH2] updated: 1.1.4-102-g8b42552

Git user git at public.curoverse.com
Tue Jun 19 04:50:11 EDT 2018


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

       via  8b42552c3532c3c48237d8d71e6a3a0636a7c47e (commit)
      from  95262273a85a2002a9f614c045fe6b907ddcc106 (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 8b42552c3532c3c48237d8d71e6a3a0636a7c47e
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Tue Jun 19 10:49:54 2018 +0200

    Create test for context menu
    
    Feature #13634
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/components/data-explorer/context-menu.test.tsx b/src/components/data-explorer/context-menu.test.tsx
new file mode 100644
index 0000000..8921808
--- /dev/null
+++ b/src/components/data-explorer/context-menu.test.tsx
@@ -0,0 +1,46 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import * as React from "react";
+import { mount, configure, shallow } from "enzyme";
+import * as Adapter from "enzyme-adapter-react-16";
+import { ContextMenu } from "./context-menu";
+import { ListItem } from "@material-ui/core";
+
+configure({ adapter: new Adapter() });
+
+describe("<ContextMenu />", () => {
+
+    const item = {
+        name: "",
+        owner: "",
+        lastModified: "",
+        type: ""
+    };
+
+    const actions = {
+        onAddToFavourite: jest.fn(),
+        onCopy: jest.fn(),
+        onDownload: jest.fn(),
+        onMoveTo: jest.fn(),
+        onRemove: jest.fn(),
+        onRename: jest.fn(),
+        onShare: jest.fn()
+    };
+
+    it("calls provided actions with provided item", () => {
+        const contextMenu = mount(<ContextMenu
+            anchorEl={document.createElement("div")}
+            onClose={jest.fn()}
+            {...{ actions, item }} />);
+
+        for (let index = 0; index < Object.keys(actions).length; index++) {
+            contextMenu.find(ListItem).at(index).simulate("click");
+        }
+
+        Object.keys(actions).forEach(key => {
+            expect(actions[key]).toHaveBeenCalledWith(item);
+        });
+    });
+});
\ No newline at end of file

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list