mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-05 04:55:50 +01:00
39 lines
990 B
JavaScript
39 lines
990 B
JavaScript
import React from "react";
|
|
import { mount, shallow } from "enzyme";
|
|
import "../../tests/enzyme";
|
|
import "../../tests/i18n";
|
|
import ReactRouterEnzymeContext from "react-router-enzyme-context";
|
|
import PermissionsNavLink from "./PermissionsNavLink";
|
|
|
|
describe("PermissionsNavLink", () => {
|
|
const options = new ReactRouterEnzymeContext();
|
|
|
|
it("should render nothing, if the modify link is missing", () => {
|
|
const repository = {
|
|
_links: {}
|
|
};
|
|
|
|
const navLink = shallow(
|
|
<PermissionsNavLink repository={repository} permissionUrl="" />,
|
|
options.get()
|
|
);
|
|
expect(navLink.text()).toBe("");
|
|
});
|
|
|
|
it("should render the navLink", () => {
|
|
const repository = {
|
|
_links: {
|
|
permissions: {
|
|
href: "/permissions"
|
|
}
|
|
}
|
|
};
|
|
|
|
const navLink = mount(
|
|
<PermissionsNavLink repository={repository} permissionUrl="" />,
|
|
options.get()
|
|
);
|
|
expect(navLink.text()).toBe("repository-root.permissions");
|
|
});
|
|
});
|