add permissions to menu of repository

This commit is contained in:
Maren Süwer
2018-08-23 09:10:38 +02:00
parent 8d2bf3308e
commit b84472b11c
4 changed files with 66 additions and 1 deletions

View File

@@ -0,0 +1,36 @@
import React from "react";
import { mount, shallow } from "enzyme";
import "../../tests/enzyme";
import "../../tests/i18n";
import PermissionsNavLink from "./PermissionsNavLink";
jest.mock("../../components/modals/ConfirmAlert");
jest.mock("../../components/navigation/NavLink", () => () => <div>foo</div>);
describe("PermissionsNavLink", () => {
it("should render nothing, if the modify link is missing", () => {
const repository = {
_links: {}
};
const navLink = shallow(
<PermissionsNavLink repository={repository} permissionUrl="" />
);
expect(navLink.text()).toBe("");
});
it("should render the navLink", () => {
const repository = {
_links: {
permissions: {
href: "/permissions"
}
}
};
const navLink = mount(
<PermissionsNavLink repository={repository} permissionUrl="" />
);
expect(navLink.text()).toBe("foo");
});
});