diff --git a/scm-ui/src/groups/containers/DeleteGroup.test.js b/scm-ui/src/groups/containers/DeleteGroup.test.js deleted file mode 100644 index 4c38623604..0000000000 --- a/scm-ui/src/groups/containers/DeleteGroup.test.js +++ /dev/null @@ -1,98 +0,0 @@ -import React from "react"; -import { mount } from "enzyme"; -import ReactRouterEnzymeContext from "react-router-enzyme-context"; -import configureStore from "redux-mock-store"; - -import "../../tests/enzyme"; -import "../../tests/i18n"; -import DeleteGroup from "./DeleteGroup"; - -import { confirmAlert } from "@scm-manager/ui-components"; - -jest.mock("@scm-manager/ui-components", () => ({ - confirmAlert: jest.fn(), - Subtitle: require.requireActual("@scm-manager/ui-components").Subtitle, - DeleteButton: require.requireActual("@scm-manager/ui-components").DeleteButton, - ErrorNotification: ({err}) => err ? err.message : null -})); - -const options = new ReactRouterEnzymeContext(); - -describe("DeleteGroupNavLink", () => { - - let store; - - beforeEach(() => { - store = configureStore()({}); - }); - - it("should render nothing, if the delete link is missing", () => { - const group = { - _links: {} - }; - - const navLink = mount( - , - options.get() - ); - expect(navLink.text()).toBeNull(); - }); - - it("should render the navLink", () => { - const group = { - _links: { - delete: { - href: "/groups" - } - } - }; - - const navLink = mount( - , - options.get() - ); - expect(navLink.text()).not.toBe(""); - }); - - it("should open the confirm dialog on navLink click", () => { - const group = { - _links: { - delete: { - href: "/groups" - } - } - }; - - const navLink = mount( - , - options.get() - ); - navLink.find("button").simulate("click"); - - expect(confirmAlert.mock.calls.length).toBe(1); - }); - - it("should call the delete group function with delete url", () => { - const group = { - _links: { - delete: { - href: "/groups" - } - } - }; - - store.dispatch = jest.fn(); - - const navLink = mount( - , - options.get() - ); - navLink.find("button").simulate("click"); - - expect(store.dispatch.mock.calls.length).toBe(1); - }); -}); diff --git a/scm-ui/src/repos/containers/DeleteRepo.test.js b/scm-ui/src/repos/containers/DeleteRepo.test.js deleted file mode 100644 index 4f3ebd1049..0000000000 --- a/scm-ui/src/repos/containers/DeleteRepo.test.js +++ /dev/null @@ -1,98 +0,0 @@ -import React from "react"; -import { mount } from "enzyme"; -import ReactRouterEnzymeContext from "react-router-enzyme-context"; -import configureStore from "redux-mock-store"; - -import "../../tests/enzyme"; -import "../../tests/i18n"; -import DeleteRepo from "./DeleteRepo"; - -import { confirmAlert } from "@scm-manager/ui-components"; - -jest.mock("@scm-manager/ui-components", () => ({ - confirmAlert: jest.fn(), - Subtitle: require.requireActual("@scm-manager/ui-components").Subtitle, - DeleteButton: require.requireActual("@scm-manager/ui-components").DeleteButton, - ErrorNotification: ({err}) => err ? err.message : null -})); - -const options = new ReactRouterEnzymeContext(); - -describe("DeleteRepo", () => { - - let store; - - beforeEach(() => { - store = configureStore()({}); - }); - - it("should render nothing, if the delete link is missing", () => { - const repository = { - _links: {} - }; - - const navLink = mount( - , - options.get() - ); - expect(navLink.text()).toBeNull(); - }); - - it("should render the navLink", () => { - const repository = { - _links: { - delete: { - href: "/repositories" - } - } - }; - - const navLink = mount( - , - options.get() - ); - expect(navLink.text()).not.toBe(""); - }); - - it("should open the confirm dialog on navLink click", () => { - const repository = { - _links: { - delete: { - href: "/repositorys" - } - } - }; - - const navLink = mount( - , - options.get() - ); - navLink.find("button").simulate("click"); - - expect(confirmAlert.mock.calls.length).toBe(1); - }); - - it("should call the delete repository function with delete url", () => { - const repository = { - _links: { - delete: { - href: "/repos" - } - } - }; - - store.dispatch = jest.fn(); - - const navLink = mount( - , - options.get() - ); - navLink.find("button").simulate("click"); - - expect(store.dispatch.mock.calls.length).toBe(1); - }); -}); diff --git a/scm-ui/src/users/containers/DeleteUser.test.js b/scm-ui/src/users/containers/DeleteUser.test.js deleted file mode 100644 index 57995c7394..0000000000 --- a/scm-ui/src/users/containers/DeleteUser.test.js +++ /dev/null @@ -1,98 +0,0 @@ -import React from "react"; -import { mount } from "enzyme"; -import ReactRouterEnzymeContext from "react-router-enzyme-context"; -import configureStore from "redux-mock-store"; - -import "../../tests/enzyme"; -import "../../tests/i18n"; -import DeleteUser from "./DeleteUser"; - -import { confirmAlert } from "@scm-manager/ui-components"; - -jest.mock("@scm-manager/ui-components", () => ({ - confirmAlert: jest.fn(), - Subtitle: require.requireActual("@scm-manager/ui-components").Subtitle, - DeleteButton: require.requireActual("@scm-manager/ui-components").DeleteButton, - ErrorNotification: ({err}) => err ? err.message : null -})); - -const options = new ReactRouterEnzymeContext(); - -describe("DeleteUser", () => { - - let store; - - beforeEach(() => { - store = configureStore()({}); - }); - - it("should render nothing, if the delete link is missing", () => { - const user = { - _links: {} - }; - - const navLink = mount( - , - options.get() - ); - expect(navLink.text()).toBeNull(); - }); - - it("should render the navLink", () => { - const user = { - _links: { - delete: { - href: "/users" - } - } - }; - - const navLink = mount( - , - options.get() - ); - expect(navLink.text()).not.toBe(""); - }); - - it("should open the confirm dialog on navLink click", () => { - const user = { - _links: { - delete: { - href: "/users" - } - } - }; - - const navLink = mount( - , - options.get() - ); - navLink.find("button").simulate("click"); - - expect(confirmAlert.mock.calls.length).toBe(1); - }); - - it("should call the delete user function with delete url", () => { - const user = { - _links: { - delete: { - href: "/users" - } - } - }; - - store.dispatch = jest.fn(); - - const navLink = mount( - , - options.get() - ); - navLink.find("button").simulate("click"); - - expect(store.dispatch.mock.calls.length).toBe(1); - }); -});