diff --git a/web/src/App.test.tsx b/web/src/App.test.tsx index f69d4114..900eef57 100644 --- a/web/src/App.test.tsx +++ b/web/src/App.test.tsx @@ -3,6 +3,7 @@ import React from "react"; import { render } from "@testing-library/react"; import App from "@root/App"; +import "@i18n/index.ts"; it("renders without crashing", () => { render(); diff --git a/web/src/components/AppStoreBadges.test.tsx b/web/src/components/AppStoreBadges.test.tsx index 71c5dbd7..35a6bac3 100644 --- a/web/src/components/AppStoreBadges.test.tsx +++ b/web/src/components/AppStoreBadges.test.tsx @@ -1,11 +1,9 @@ import React from "react"; -import ReactDOM from "react-dom"; +import { render } from "@testing-library/react"; import AppStoreBadges from "@components/AppStoreBadges"; it("renders without crashing", () => { - const div = document.createElement("div"); - ReactDOM.render(, div); - ReactDOM.unmountComponentAtNode(div); + render(); }); diff --git a/web/src/components/ColoredSnackbarContent.test.tsx b/web/src/components/ColoredSnackbarContent.test.tsx index 748dc7b0..02af9bbc 100644 --- a/web/src/components/ColoredSnackbarContent.test.tsx +++ b/web/src/components/ColoredSnackbarContent.test.tsx @@ -1,14 +1,12 @@ import React from "react"; import { render, screen } from "@testing-library/react"; -import ReactDOM from "react-dom"; import ColoredSnackbarContent from "@components/ColoredSnackbarContent"; it("renders without crashing", () => { - const div = document.createElement("div"); - ReactDOM.render(, div); - ReactDOM.unmountComponentAtNode(div); + render(); + expect(screen.getByRole("alert")).toHaveTextContent(""); }); it("should contain the message", () => { diff --git a/web/src/components/PasswordMeter.test.tsx b/web/src/components/PasswordMeter.test.tsx index 790ddd6f..212c9233 100644 --- a/web/src/components/PasswordMeter.test.tsx +++ b/web/src/components/PasswordMeter.test.tsx @@ -3,6 +3,7 @@ import React from "react"; import { render } from "@testing-library/react"; import PasswordMeter from "@components/PasswordMeter"; +import "@i18n/index.ts"; import { PasswordPolicyMode } from "@models/PasswordPolicy"; it("renders without crashing", () => { diff --git a/web/src/components/PasswordMeter.tsx b/web/src/components/PasswordMeter.tsx index 71b5fb74..43b26143 100644 --- a/web/src/components/PasswordMeter.tsx +++ b/web/src/components/PasswordMeter.tsx @@ -17,7 +17,7 @@ const PasswordMeter = function (props: Props) { const [passwordScore, setPasswordScore] = useState(0); const [maxScores, setMaxScores] = useState(0); const [feedback, setFeedback] = useState(""); - const { t: translate } = useTranslation("Portal"); + const { t: translate } = useTranslation(); const style = makeStyles((theme) => ({ progressBar: { height: "5px",