2019-10-20 18:02:52 +02:00
|
|
|
import React from "react";
|
2020-01-08 15:57:13 +01:00
|
|
|
import { mount, shallow } from "@scm-manager/ui-tests/enzyme-router";
|
2019-10-20 18:02:52 +02:00
|
|
|
import "@scm-manager/ui-tests/enzyme";
|
|
|
|
|
import "@scm-manager/ui-tests/i18n";
|
2019-10-19 16:38:07 +02:00
|
|
|
|
2019-10-20 18:02:52 +02:00
|
|
|
import EditRepoNavLink from "./EditRepoNavLink";
|
2019-10-19 16:38:07 +02:00
|
|
|
|
2019-10-20 18:02:52 +02:00
|
|
|
describe("GeneralNavLink", () => {
|
|
|
|
|
it("should render nothing, if the modify link is missing", () => {
|
2019-10-19 16:38:07 +02:00
|
|
|
const repository = {
|
2019-10-20 18:02:52 +02:00
|
|
|
_links: {}
|
2019-10-19 16:38:07 +02:00
|
|
|
};
|
|
|
|
|
|
2019-10-21 10:57:56 +02:00
|
|
|
const navLink = shallow(<EditRepoNavLink repository={repository} editUrl="" />);
|
2019-10-20 18:02:52 +02:00
|
|
|
expect(navLink.text()).toBe("");
|
2019-10-19 16:38:07 +02:00
|
|
|
});
|
|
|
|
|
|
2019-10-20 18:02:52 +02:00
|
|
|
it("should render the navLink", () => {
|
2019-10-19 16:38:07 +02:00
|
|
|
const repository = {
|
|
|
|
|
_links: {
|
|
|
|
|
update: {
|
2019-10-20 18:02:52 +02:00
|
|
|
href: "/repositories"
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-10-19 16:38:07 +02:00
|
|
|
};
|
|
|
|
|
|
2019-10-21 10:57:56 +02:00
|
|
|
const navLink = mount(<EditRepoNavLink repository={repository} editUrl="" />);
|
2019-10-20 18:02:52 +02:00
|
|
|
expect(navLink.text()).toBe("repositoryRoot.menu.generalNavLink");
|
2019-10-19 16:38:07 +02:00
|
|
|
});
|
|
|
|
|
});
|