mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-03-08 05:10:20 +01:00
fixed failing tests and added helper for tests with i18n
This commit is contained in:
7
scm-ui/src/tests/i18n.js
Normal file
7
scm-ui/src/tests/i18n.js
Normal file
@@ -0,0 +1,7 @@
|
||||
jest.mock("react-i18next", () => ({
|
||||
// this mock makes sure any components using the translate HoC receive the t function as a prop
|
||||
translate: () => Component => {
|
||||
Component.defaultProps = { ...Component.defaultProps, t: key => key };
|
||||
return Component;
|
||||
}
|
||||
}));
|
||||
@@ -1,6 +1,7 @@
|
||||
import React from "react";
|
||||
import { mount, shallow } from "enzyme";
|
||||
import "../../tests/enzyme";
|
||||
import "../../tests/i18n";
|
||||
import DeleteUserButton from "./DeleteUserButton";
|
||||
|
||||
import { confirmAlert } from "../../components/ConfirmAlert";
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import React from "react";
|
||||
import { configure, shallow } from "enzyme";
|
||||
import "../../tests/enzyme";
|
||||
import "../../tests/i18n";
|
||||
import EditUserButton from "./EditUserButton";
|
||||
|
||||
it("should render nothing, if the edit link is missing", () => {
|
||||
|
||||
@@ -154,7 +154,6 @@ export function createUserPending(user: User) {
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
export function createUserSuccess() {
|
||||
return {
|
||||
type: CREATE_USER_SUCCESS
|
||||
@@ -181,7 +180,6 @@ export function modifyUser(user: User) {
|
||||
dispatch(fetchUsers());
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err);
|
||||
dispatch(modifyUserFailure(user, err));
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user