2019-10-20 18:02:52 +02:00
|
|
|
import React from "react";
|
|
|
|
|
import { shallow } from "enzyme";
|
|
|
|
|
import "@scm-manager/ui-tests/enzyme";
|
|
|
|
|
import "@scm-manager/ui-tests/i18n";
|
|
|
|
|
import ChangePasswordNavLink from "./SetPasswordNavLink";
|
2019-10-19 16:38:07 +02:00
|
|
|
|
2019-10-20 18:02:52 +02:00
|
|
|
it("should render nothing, if the password link is missing", () => {
|
2019-10-19 16:38:07 +02:00
|
|
|
const user = {
|
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(<ChangePasswordNavLink user={user} passwordUrl="/user/password" />);
|
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 user = {
|
|
|
|
|
_links: {
|
|
|
|
|
password: {
|
2019-10-20 18:02:52 +02:00
|
|
|
href: "/password"
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-10-19 16:38:07 +02:00
|
|
|
};
|
|
|
|
|
|
2019-10-21 10:57:56 +02:00
|
|
|
const navLink = shallow(<ChangePasswordNavLink user={user} passwordUrl="/user/password" />);
|
2019-10-20 18:02:52 +02:00
|
|
|
expect(navLink.text()).not.toBe("");
|
2019-10-19 16:38:07 +02:00
|
|
|
});
|