Fix instances of double translation and guard translation calls using typescript (#11443)

Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
This commit is contained in:
Michael Telatynski 2023-08-22 16:32:05 +01:00 committed by GitHub
parent d13b6e1b41
commit ac70f7ac9b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
157 changed files with 554 additions and 780 deletions

View file

@ -21,6 +21,7 @@ import { render, screen } from "@testing-library/react";
import { shouldShowFeedback } from "../../../../src/utils/Feedback";
import BetaCard from "../../../../src/components/views/beta/BetaCard";
import SettingsStore from "../../../../src/settings/SettingsStore";
import { TranslationKey } from "../../../../src/languageHandler";
jest.mock("../../../../src/utils/Feedback");
jest.mock("../../../../src/settings/SettingsStore");
@ -31,10 +32,10 @@ describe("<BetaCard />", () => {
beforeEach(() => {
mocked(SettingsStore).getBetaInfo.mockReturnValue({
title: "title",
title: "title" as TranslationKey,
caption: () => "caption",
feedbackLabel: "feedbackLabel",
feedbackSubheading: "feedbackSubheading",
feedbackSubheading: "feedbackSubheading" as TranslationKey,
});
mocked(SettingsStore).getValue.mockReturnValue(true);
mocked(shouldShowFeedback).mockReturnValue(true);
@ -53,9 +54,9 @@ describe("<BetaCard />", () => {
it("should not show feedback prompt if label is unset", () => {
mocked(SettingsStore).getBetaInfo.mockReturnValue({
title: "title",
title: "title" as TranslationKey,
caption: () => "caption",
feedbackSubheading: "feedbackSubheading",
feedbackSubheading: "feedbackSubheading" as TranslationKey,
});
render(<BetaCard featureId={featureId} />);
expect(screen.queryByText("Feedback")).toBeFalsy();
@ -63,7 +64,7 @@ describe("<BetaCard />", () => {
it("should not show feedback prompt if subheading is unset", () => {
mocked(SettingsStore).getBetaInfo.mockReturnValue({
title: "title",
title: "title" as TranslationKey,
caption: () => "caption",
feedbackLabel: "feedbackLabel",
});