Fixed unit tests

This commit is contained in:
Philipp Czora
2019-02-14 14:13:50 +01:00
parent cbc097acfd
commit 0273bc5516

View File

@@ -29,7 +29,7 @@ describe("DeletePermissionButton", () => {
expect(navLink.text()).toBe(""); expect(navLink.text()).toBe("");
}); });
it("should render the navLink", () => { it("should render the delete icon", () => {
const permission = { const permission = {
_links: { _links: {
delete: { delete: {
@@ -38,14 +38,14 @@ describe("DeletePermissionButton", () => {
} }
}; };
const navLink = mount( const deleteIcon = mount(
<DeletePermissionButton <DeletePermissionButton
permission={permission} permission={permission}
deletePermission={() => {}} deletePermission={() => {}}
/>, />,
options.get() options.get()
); );
expect(navLink.text()).not.toBe(""); expect(deleteIcon.html()).not.toBe("");
}); });
it("should open the confirm dialog on button click", () => { it("should open the confirm dialog on button click", () => {
@@ -64,7 +64,7 @@ describe("DeletePermissionButton", () => {
/>, />,
options.get() options.get()
); );
button.find("button").simulate("click"); button.find(".fa-trash").simulate("click");
expect(confirmAlert.mock.calls.length).toBe(1); expect(confirmAlert.mock.calls.length).toBe(1);
}); });
@@ -91,7 +91,7 @@ describe("DeletePermissionButton", () => {
/>, />,
options.get() options.get()
); );
button.find("button").simulate("click"); button.find(".fa-trash").simulate("click");
expect(calledUrl).toBe("/permission"); expect(calledUrl).toBe("/permission");
}); });