Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mock react-i18next globally #2954

Merged
merged 4 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/components/App/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import { act, create } from "react-test-renderer";
import configureMockStore from "redux-mock-store";
import thunk from "redux-thunk";

import "tests/reactI18nextMock";

import { defaultState } from "components/App/DefaultState";
import App from "components/App/component";

Expand Down
2 changes: 0 additions & 2 deletions src/components/AppBar/tests/AppBarComponent.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { MemoryRouter } from "react-router-dom";
import { act, create } from "react-test-renderer";
import configureMockStore from "redux-mock-store";

import "tests/reactI18nextMock";

import { defaultState } from "components/App/DefaultState";
import AppBar from "components/AppBar/AppBarComponent";

Expand Down
2 changes: 0 additions & 2 deletions src/components/AppBar/tests/NavigationButtons.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import { Provider } from "react-redux";
import renderer, { ReactTestInstance } from "react-test-renderer";
import configureMockStore from "redux-mock-store";

import "tests/reactI18nextMock";

import { Permission } from "api";
import NavigationButtons, {
dataCleanupButtonId,
Expand Down
2 changes: 0 additions & 2 deletions src/components/AppBar/tests/ProjectButtons.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { Provider } from "react-redux";
import { ReactTestRenderer, act, create } from "react-test-renderer";
import configureMockStore, { MockStoreEnhanced } from "redux-mock-store";

import "tests/reactI18nextMock";

import { Permission } from "api/models";
import ProjectButtons, {
projButtonId,
Expand Down
2 changes: 0 additions & 2 deletions src/components/AppBar/tests/SpeakerMenu.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import { Provider } from "react-redux";
import { act, create, ReactTestRenderer } from "react-test-renderer";
import configureMockStore from "redux-mock-store";

import "tests/reactI18nextMock";

import { Speaker } from "api/models";
import SpeakerMenu, { SpeakerMenuList } from "components/AppBar/SpeakerMenu";
import { defaultState } from "components/Project/ProjectReduxTypes";
Expand Down
2 changes: 0 additions & 2 deletions src/components/AppBar/tests/UserMenu.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { Provider } from "react-redux";
import { act, create, ReactTestRenderer } from "react-test-renderer";
import configureMockStore from "redux-mock-store";

import "tests/reactI18nextMock";

import UserMenu, { UserMenuList } from "components/AppBar/UserMenu";
import { Path } from "types/path";

Expand Down
2 changes: 0 additions & 2 deletions src/components/Buttons/tests/DeleteButtonWithDialog.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { ReactTestRenderer, act, create } from "react-test-renderer";

import "tests/reactI18nextMock";

import DeleteButtonWithDialog from "components/Buttons/DeleteButtonWithDialog";
import { CancelConfirmDialog } from "components/Dialogs";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import renderer from "react-test-renderer";

import "tests/reactI18nextMock";

import DeleteEntry from "components/DataEntry/DataEntryTable/EntryCellComponents/DeleteEntry";

describe("DeleteEntry", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import {
create,
} from "react-test-renderer";

import "tests/reactI18nextMock";

import EntryNote from "components/DataEntry/DataEntryTable/EntryCellComponents/EntryNote";

const mockText = "Test text";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { Provider } from "react-redux";
import renderer from "react-test-renderer";
import configureMockStore from "redux-mock-store";

import "tests/reactI18nextMock";

import { Word } from "api/models";
import { SenseList } from "components/DataEntry/DataEntryTable/NewEntry/SenseDialog";
import StyledMenuItem from "components/DataEntry/DataEntryTable/NewEntry/StyledMenuItem";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { Provider } from "react-redux";
import renderer from "react-test-renderer";
import configureMockStore from "redux-mock-store";

import "tests/reactI18nextMock";

import { Word } from "api/models";
import StyledMenuItem from "components/DataEntry/DataEntryTable/NewEntry/StyledMenuItem";
import { VernList } from "components/DataEntry/DataEntryTable/NewEntry/VernDialog";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { Provider } from "react-redux";
import { type ReactTestRenderer, act, create } from "react-test-renderer";
import configureMockStore from "redux-mock-store";

import "tests/reactI18nextMock";

import {
GlossWithSuggestions,
VernWithSuggestions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import {
} from "react-test-renderer";
import configureMockStore from "redux-mock-store";

import "tests/reactI18nextMock";

import { Word } from "api/models";
import { defaultState } from "components/App/DefaultState";
import {
Expand Down
2 changes: 0 additions & 2 deletions src/components/DataEntry/DataEntryTable/tests/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import {
} from "react-test-renderer";
import configureMockStore from "redux-mock-store";

import "tests/reactI18nextMock";

import { Gloss, SemanticDomain, Sense, Word } from "api/models";
import { defaultState } from "components/App/DefaultState";
import DataEntryTable, {
Expand Down
2 changes: 0 additions & 2 deletions src/components/DataEntry/tests/DataEntryHeader.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import { Provider } from "react-redux";
import renderer, { ReactTestInstance } from "react-test-renderer";
import configureMockStore from "redux-mock-store";

import "tests/reactI18nextMock";

import { SemanticDomainFull } from "api/models";
import DataEntryHeader from "components/DataEntry/DataEntryHeader";
import { newSemanticDomain } from "types/semanticDomain";
Expand Down
2 changes: 0 additions & 2 deletions src/components/DataEntry/tests/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import { Provider } from "react-redux";
import renderer from "react-test-renderer";
import createMockStore from "redux-mock-store";

import "tests/reactI18nextMock";

import DataEntry, {
smallScreenThreshold,
treeViewDialogId,
Expand Down
1 change: 0 additions & 1 deletion src/components/GoalTimeline/tests/GoalRedux.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import "@testing-library/jest-dom";
import { act, cleanup } from "@testing-library/react";

import "tests/reactI18nextMock";
import { Edit, MergeUndoIds, Permission, User, UserEdit } from "api/models";
import * as LocalStorage from "backend/localStorage";
import GoalTimeline from "components/GoalTimeline";
Expand Down
2 changes: 0 additions & 2 deletions src/components/GoalTimeline/tests/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { Provider } from "react-redux";
import renderer from "react-test-renderer";
import createMockStore from "redux-mock-store";

import "tests/reactI18nextMock";

import { Permission } from "api/models";
import GoalTimeline, { createSuggestionData } from "components/GoalTimeline";
import { type GoalsState, defaultState } from "goals/Redux/GoalReduxTypes";
Expand Down
2 changes: 0 additions & 2 deletions src/components/Login/tests/Login.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import {
} from "react-test-renderer";
import configureMockStore from "redux-mock-store";

import "tests/reactI18nextMock";

import Login, { LoginId } from "components/Login/Login";
import { defaultState as loginState } from "components/Login/Redux/LoginReduxTypes";

Expand Down
2 changes: 0 additions & 2 deletions src/components/Login/tests/Signup.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import {
} from "react-test-renderer";
import configureMockStore from "redux-mock-store";

import "tests/reactI18nextMock";

import { defaultState as loginState } from "components/Login/Redux/LoginReduxTypes";
import Signup, { SignupId } from "components/Login/Signup";

Expand Down
2 changes: 0 additions & 2 deletions src/components/PageNotFound/tests/component.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import renderer from "react-test-renderer";

import "tests/reactI18nextMock";

import PageNotFound from "components/PageNotFound/component";

jest.mock("react-router-dom");
Expand Down
1 change: 0 additions & 1 deletion src/components/PasswordReset/tests/Request.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import "@testing-library/jest-dom";
import { act, cleanup, render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";

import "tests/reactI18nextMock";
import ResetRequest, {
PasswordRequestIds,
} from "components/PasswordReset/Request";
Expand Down
1 change: 0 additions & 1 deletion src/components/PasswordReset/tests/ResetPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { Provider } from "react-redux";
import { MemoryRouter, Route, Routes } from "react-router-dom";
import configureMockStore from "redux-mock-store";

import "tests/reactI18nextMock";
import PasswordReset, {
PasswordResetTestIds,
} from "components/PasswordReset/ResetPage";
Expand Down
2 changes: 0 additions & 2 deletions src/components/ProjectScreen/tests/ChooseProject.test.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { ListItemButton } from "@mui/material";
import renderer from "react-test-renderer";

import "tests/reactI18nextMock";

import { type Project } from "api/models";
import ChooseProject from "components/ProjectScreen/ChooseProject";
import { newProject } from "types/project";
Expand Down
2 changes: 0 additions & 2 deletions src/components/ProjectScreen/tests/CreateProject.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import {
} from "react-test-renderer";
import configureMockStore from "redux-mock-store";

import "tests/reactI18nextMock";

import { FileInputButton } from "components/Buttons";
import CreateProject, {
buttonIdSubmit,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { Button, IconButton } from "@mui/material";
import renderer from "react-test-renderer";

import "tests/reactI18nextMock";

import { Project } from "api/models";
import ProjectSchedule from "components/ProjectSettings/ProjectSchedule";
import { newProject } from "types/project";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { Select } from "@mui/material";
import renderer from "react-test-renderer";

import "tests/reactI18nextMock";

import { AutocompleteSetting } from "api/models";
import ProjectAutocomplete from "components/ProjectSettings/ProjectAutocomplete";
import { randomProject } from "types/project";
Expand Down
2 changes: 0 additions & 2 deletions src/components/ProjectSettings/tests/ProjectImport.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import renderer from "react-test-renderer";

import "tests/reactI18nextMock";

import { FileInputButton } from "components/Buttons";
import ProjectImport, {
uploadFileButtonId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import { Button, IconButton, Select } from "@mui/material";
import { LanguagePicker } from "mui-language-picker";
import renderer from "react-test-renderer";

import "tests/reactI18nextMock";

import { Project, WritingSystem } from "api/models";
import ProjectLanguages, {
editVernacularNameButtonId,
Expand Down
2 changes: 0 additions & 2 deletions src/components/ProjectSettings/tests/ProjectName.test.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { Button, TextField } from "@mui/material";
import renderer from "react-test-renderer";

import "tests/reactI18nextMock";

import ProjectName from "components/ProjectSettings/ProjectName";
import { randomProject } from "types/project";

Expand Down
2 changes: 0 additions & 2 deletions src/components/ProjectSettings/tests/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import { Provider } from "react-redux";
import { Store } from "redux";
import configureMockStore from "redux-mock-store";

import "tests/reactI18nextMock";

import { Permission } from "api/models";
import { defaultState as exportProjectState } from "components/ProjectExport/Redux/ExportProjectReduxTypes";
import ProjectSettings, {
Expand Down
2 changes: 0 additions & 2 deletions src/components/ProjectUsers/tests/EmailInvite.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import renderer from "react-test-renderer";

import "tests/reactI18nextMock.ts";

import { LoadingDoneButton } from "components/Buttons";
import EmailInvite from "components/ProjectUsers/EmailInvite";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import renderer from "react-test-renderer";

import "tests/reactI18nextMock.ts";

import ProjectSpeakersList, {
AddSpeakerListItem,
SpeakerListItem,
Expand Down
2 changes: 0 additions & 2 deletions src/components/ProjectUsers/tests/SortOptions.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import renderer from "react-test-renderer";

import "tests/reactI18nextMock.ts";

import SortOptions, {
SortOptionsProps,
reverseButtonId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import { act, cleanup, render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { ReactElement } from "react";

import "tests/reactI18nextMock";

import { ConsentType, Speaker } from "api/models";
import SpeakerConsentListItemIcon, {
ListItemIconId,
Expand Down
2 changes: 0 additions & 2 deletions src/components/ProjectUsers/tests/UserList.test.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { Input, ListItem } from "@mui/material";
import renderer from "react-test-renderer";

import "tests/reactI18nextMock.ts";

import { User } from "api/models";
import UserList from "components/ProjectUsers/UserList";
import { newUser } from "types/user";
Expand Down
2 changes: 0 additions & 2 deletions src/components/Pronunciations/tests/AudioRecorder.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { Provider } from "react-redux";
import { ReactTestRenderer, act, create } from "react-test-renderer";
import configureMockStore from "redux-mock-store";

import "tests/reactI18nextMock";

import { defaultState } from "components/App/DefaultState";
import AudioRecorder from "components/Pronunciations/AudioRecorder";
import RecorderIcon, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { Provider } from "react-redux";
import { ReactTestRenderer, act, create } from "react-test-renderer";
import configureMockStore from "redux-mock-store";

import "tests/reactI18nextMock";

import { defaultState } from "components/App/DefaultState";
import AudioPlayer from "components/Pronunciations/AudioPlayer";
import AudioRecorder from "components/Pronunciations/AudioRecorder";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import { Provider } from "react-redux";
import renderer from "react-test-renderer";
import configureMockStore from "redux-mock-store";

import "tests/reactI18nextMock";

import { defaultState } from "components/App/DefaultState";
import AudioPlayer from "components/Pronunciations/AudioPlayer";
import AudioRecorder from "components/Pronunciations/AudioRecorder";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { ListItem } from "@mui/material";
import renderer from "react-test-renderer";

import "tests/reactI18nextMock";

import ExportButton from "components/ProjectExport/ExportButton";
import ProjectArchive from "components/ProjectSettings/ProjectArchive";
import { ProjectList } from "components/SiteSettings/ProjectManagement";
Expand Down
2 changes: 0 additions & 2 deletions src/components/SiteSettings/tests/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import "@testing-library/jest-dom";
import { act, cleanup, render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";

import "tests/reactI18nextMock";

import SiteSettings, { SiteSettingsTab } from "components/SiteSettings";

const mockGetAllProjects = jest.fn();
Expand Down
2 changes: 0 additions & 2 deletions src/components/Statistics/tests/DomainStatistics.test.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { ListItem } from "@mui/material";
import { ReactTestRenderer, act, create } from "react-test-renderer";

import "tests/reactI18nextMock";

import { SemanticDomainCount } from "api";
import DomainStatistics from "components/Statistics/DomainStatistics";
import {
Expand Down
2 changes: 0 additions & 2 deletions src/components/Statistics/tests/Statistics.test.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { StyledEngineProvider, ThemeProvider } from "@mui/material/styles";
import { ReactTestRenderer, act, create } from "react-test-renderer";

import "tests/reactI18nextMock";

import Statistics from "components/Statistics/Statistics";
import { newProject } from "types/project";
import theme from "types/theme";
Expand Down
2 changes: 0 additions & 2 deletions src/components/Statistics/tests/UserStatistics.test.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { ListItem } from "@mui/material";
import { ReactTestRenderer, act, create } from "react-test-renderer";

import "tests/reactI18nextMock";

import { SemanticDomainUserCount } from "api";
import UserStatistics from "components/Statistics/UserStatistics";
import { newSemanticDomainUserCount } from "types/semanticDomain";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { Button } from "@mui/material";
import { ReactTestRenderer, act, create } from "react-test-renderer";

import "tests/reactI18nextMock";

import DomainTileButton from "components/TreeView/TreeDepiction/DomainTileButton";
import { Direction } from "components/TreeView/TreeDepiction/TreeDepictionTypes";
import domMap, { mapIds } from "components/TreeView/tests/SemanticDomainMock";
Expand Down
Loading
Loading