mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-11 07:55:47 +01:00
fix router tests and create seaparate package ui-tests
This commit is contained in:
@@ -1,18 +1,16 @@
|
||||
import React from "react";
|
||||
import { mount, shallow } from "enzyme";
|
||||
import "../../../../tests/enzyme";
|
||||
import "../../../../tests/i18n";
|
||||
import { shallow, mount } from "@scm-manager/ui-tests/enzyme-router";
|
||||
import "@scm-manager/ui-tests/enzyme";
|
||||
import "@scm-manager/ui-tests/i18n";
|
||||
import DeletePermissionButton from "./DeletePermissionButton";
|
||||
|
||||
import { confirmAlert } from "@scm-manager/ui-components";
|
||||
import ReactRouterEnzymeContext from "react-router-enzyme-context";
|
||||
jest.mock("@scm-manager/ui-components", () => ({
|
||||
confirmAlert: jest.fn(),
|
||||
DeleteButton: require.requireActual("@scm-manager/ui-components").DeleteButton
|
||||
}));
|
||||
|
||||
describe("DeletePermissionButton", () => {
|
||||
const options = new ReactRouterEnzymeContext();
|
||||
|
||||
it("should render nothing, if the delete link is missing", () => {
|
||||
const permission = {
|
||||
@@ -23,8 +21,7 @@ describe("DeletePermissionButton", () => {
|
||||
<DeletePermissionButton
|
||||
permission={permission}
|
||||
deletePermission={() => {}}
|
||||
/>,
|
||||
options.get()
|
||||
/>
|
||||
);
|
||||
expect(navLink.text()).toBe("");
|
||||
});
|
||||
@@ -42,8 +39,7 @@ describe("DeletePermissionButton", () => {
|
||||
<DeletePermissionButton
|
||||
permission={permission}
|
||||
deletePermission={() => {}}
|
||||
/>,
|
||||
options.get()
|
||||
/>
|
||||
);
|
||||
expect(deleteIcon.html()).not.toBe("");
|
||||
});
|
||||
@@ -61,8 +57,7 @@ describe("DeletePermissionButton", () => {
|
||||
<DeletePermissionButton
|
||||
permission={permission}
|
||||
deletePermission={() => {}}
|
||||
/>,
|
||||
options.get()
|
||||
/>
|
||||
);
|
||||
button.find(".fa-trash").simulate("click");
|
||||
|
||||
@@ -88,8 +83,7 @@ describe("DeletePermissionButton", () => {
|
||||
permission={permission}
|
||||
confirmDialog={false}
|
||||
deletePermission={capture}
|
||||
/>,
|
||||
options.get()
|
||||
/>
|
||||
);
|
||||
button.find(".fa-trash").simulate("click");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user