Update tests
authorMichal Klobukowski <michal.klobukowski@contractors.roche.com>
Fri, 13 Jul 2018 15:34:53 +0000 (17:34 +0200)
committerMichal Klobukowski <michal.klobukowski@contractors.roche.com>
Fri, 13 Jul 2018 15:34:53 +0000 (17:34 +0200)
Feature #13805

Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski@contractors.roche.com>

src/common/api/common-resource-service.test.ts
src/components/context-menu/context-menu.test.tsx
src/services/groups-service/groups-service.test.ts

index b8b1f44cc28a14d1075c3a94dc9604b62f8d7660..7093b59c555430953ed0e678ee56ff10566aa4bb 100644 (file)
@@ -4,7 +4,7 @@
 
 import CommonResourceService from "./common-resource-service";
 import axios from "axios";
-import MockAdapter from "axios-mock-adapter/types";
+import MockAdapter from "axios-mock-adapter";
 
 describe("CommonResourceService", () => {
     const axiosInstance = axios.create();
index e4e2397da280ae7ddfa20d9a7a6ed816c5c83c80..86011a3cee0e90014a476b779b9a12f0e3fe6072 100644 (file)
@@ -7,29 +7,30 @@ 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";
+import { IconTypes } from "../icon/icon";
 
 configure({ adapter: new Adapter() });
 
 describe("<ContextMenu />", () => {
-    const actions = [[{
-        icon: "",
+    const items = [[{
+        icon: IconTypes.ANNOUNCEMENT,
         name: "Action 1.1"
     }, {
-        icon: "",
+        icon: IconTypes.ANNOUNCEMENT,
         name: "Action 1.2"
     },], [{
-        icon: "",
+        icon: IconTypes.ANNOUNCEMENT,
         name: "Action 2.1"
     }]];
 
-    it("calls onActionClick with clicked action", () => {
-        const onActionClick = jest.fn();
+    it("calls onItemClick with clicked action", () => {
+        const onItemClick = jest.fn();
         const contextMenu = mount(<ContextMenu
             anchorEl={document.createElement("div")}
             onClose={jest.fn()}
-            onActionClick={onActionClick}
-            actions={actions} />);
+            onItemClick={onItemClick}
+            items={items} />);
         contextMenu.find(ListItem).at(2).simulate("click");
-        expect(onActionClick).toHaveBeenCalledWith(actions[1][0]);
+        expect(onItemClick).toHaveBeenCalledWith(items[1][0]);
     });
 });
\ No newline at end of file
index 92d227781cc64dddc51c5577d55d31fb351691f2..2562a595d02ff52b0c0af4954d10f5fb20e67e06 100644 (file)
@@ -3,7 +3,7 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import axios from "axios";
-import MockAdapter from "axios-mock-adapter/types";
+import MockAdapter from "axios-mock-adapter";
 import GroupsService from "./groups-service";
 
 describe("GroupsService", () => {