Skip to content

Commit

Permalink
Rename function and file
Browse files Browse the repository at this point in the history
  • Loading branch information
matthijsgroen committed Jun 21, 2024
1 parent ca4ab6e commit f8df070
Show file tree
Hide file tree
Showing 53 changed files with 129 additions and 125 deletions.
4 changes: 2 additions & 2 deletions src/components/AuthenticatedRoute.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import AuthenticatedRoute from "./AuthenticatedRoute";
import { Auth } from "../support";
import { screen } from "@testing-library/react";
import { setComponent } from "../support/testing/testComponent";
import { setTestSubject } from "../support/testing/testSubject";
import { PATH_CHOOSE_TEAM, PATH_LOGIN } from "../routes";
import { routingDecorator } from "../support/testing/testDecorators";

jest.mock("../support/auth");

describe("<AuthenticatedRoute />", () => {
const { renderComponent, updateDecorator, updateProps } = setComponent(
const { renderComponent, updateDecorator, updateProps } = setTestSubject(
AuthenticatedRoute,
{
decorators: [routingDecorator()],
Expand Down
4 changes: 2 additions & 2 deletions src/components/Circle/Circle.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { setComponent } from "../../support/testing/testComponent";
import { setTestSubject } from "../../support/testing/testSubject";
import CustomCircle from "./Circle";
import { screen } from "@testing-library/react";

describe("<CustomCircle />", () => {
const { setProps, renderComponent } = setComponent(CustomCircle);
const { setProps, renderComponent } = setTestSubject(CustomCircle);
setProps({
percent: 50,
currentKudos: 200,
Expand Down
4 changes: 2 additions & 2 deletions src/components/navigation/Desktop.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { screen } from "@testing-library/react";
import { mockLocalstorage } from "../../spec_helper";
import Desktop, { GET_USER } from "./Desktop";
import { setComponent } from "../../support/testing/testComponent";
import { setTestSubject } from "../../support/testing/testSubject";
import {
dataDecorator,
routingDecorator,
Expand All @@ -25,7 +25,7 @@ export const mocks = () => [
];

describe("<Desktop />", () => {
const { renderComponent } = setComponent(Desktop, {
const { renderComponent } = setTestSubject(Desktop, {
decorators: [dataDecorator(mocks()), routingDecorator()],
props: {},
});
Expand Down
4 changes: 2 additions & 2 deletions src/components/navigation/Mobile.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import { mockLocalstorage } from "../../spec_helper";
import Mobile from "./Mobile";
import { Auth } from "../../support";
import { screen } from "@testing-library/react";
import { setComponent } from "../../support/testing/testComponent";
import { setTestSubject } from "../../support/testing/testSubject";
import { routingDecorator } from "../../support/testing/testDecorators";

describe("<Mobile />", () => {
mockLocalstorage("fakeToken");

const { renderComponent } = setComponent(Mobile, {
const { renderComponent } = setTestSubject(Mobile, {
decorators: [routingDecorator()],
props: {},
});
Expand Down
4 changes: 2 additions & 2 deletions src/components/organisms/RepoList/RepoList.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { screen } from "@testing-library/react";
import { GET_POSTS } from "../../../modules/feed/queries";
import { mockLocalstorage } from "../../../spec_helper";
import { RepoList } from "./RepoList";
import { setComponent } from "../../../support/testing/testComponent";
import { setTestSubject } from "../../../support/testing/testSubject";
import { dataDecorator } from "../../../support/testing/testDecorators";

export const mocks = (hasNextPage: boolean) => [
Expand Down Expand Up @@ -81,7 +81,7 @@ const mocksWithError = [
];

describe("<RepoList />", () => {
const { renderComponent, updateDecorator } = setComponent(RepoList, {
const { renderComponent, updateDecorator } = setTestSubject(RepoList, {
decorators: [dataDecorator(mocks(false))],
props: {},
});
Expand Down
4 changes: 2 additions & 2 deletions src/components/upload/ImageUpload.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { setComponent } from "../../support/testing/testComponent";
import { setTestSubject } from "../../support/testing/testSubject";
import { ImageUpload } from "./ImageUpload";
import { screen, waitFor } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
Expand All @@ -16,7 +16,7 @@ const createFile = (name: string, size: number, type: string): File => {
describe("<ImageUpload />", () => {
let selectedFiles: any = [];

const { setProps, renderComponent } = setComponent(ImageUpload);
const { setProps, renderComponent } = setTestSubject(ImageUpload);
setProps({
onChange: (files) => {
selectedFiles = files;
Expand Down
4 changes: 2 additions & 2 deletions src/modules/choose-team/ChooseTeamPage.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Content } from "./ChooseTeamPage";
import { screen, fireEvent } from "@testing-library/react";
import { GET_INVITES } from "./components/InviteList";
import { GET_TEAMS } from "./components/TeamList";
import { setComponent } from "../../support/testing/testComponent";
import { setTestSubject } from "../../support/testing/testSubject";
import { dataDecorator } from "../../support/testing/testDecorators";

const mockHistoryPush = jest.fn();
Expand Down Expand Up @@ -86,7 +86,7 @@ const mockWithInvites = [
];

describe("<ChooseTeamPage />", () => {
const { renderComponent } = setComponent(Content, {
const { renderComponent } = setTestSubject(Content, {
decorators: [dataDecorator(mockWithInvites)],
props: {},
});
Expand Down
4 changes: 2 additions & 2 deletions src/modules/choose-team/CreateTeamPage.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { GraphQLError } from "graphql";
import CreateTeamPage, { MUTATION_CREATE_TEAM } from "./CreateTeamPage";
import { Storage } from "../../support/storage";
import { fireEvent, screen, waitFor } from "@testing-library/react";
import { setComponent } from "../../support/testing/testComponent";
import { setTestSubject } from "../../support/testing/testSubject";
import {
dataDecorator,
routingDecorator,
Expand Down Expand Up @@ -35,7 +35,7 @@ const mocksWithError = [
];

describe("<CreateTeamPage />", () => {
const { renderComponent, updateDecorator } = setComponent(CreateTeamPage, {
const { renderComponent, updateDecorator } = setTestSubject(CreateTeamPage, {
decorators: [dataDecorator(mocks), routingDecorator()],
props: {},
});
Expand Down
4 changes: 2 additions & 2 deletions src/modules/choose-team/components/ChoiceButton.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import ChoiceButton from "./ChoiceButton";
import { Storage } from "../../../support/storage";
import { screen, waitFor } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { setComponent } from "../../../support/testing/testComponent";
import { setTestSubject } from "../../../support/testing/testSubject";
import { dataDecorator } from "../../../support/testing/testDecorators";

const fakeMutation = gql`
Expand Down Expand Up @@ -39,7 +39,7 @@ jest.mock("react-router-dom", () => ({
}));

describe("<ChoiceButton />", () => {
const { renderComponent, updateProps } = setComponent(ChoiceButton, {
const { renderComponent, updateProps } = setTestSubject(ChoiceButton, {
decorators: [dataDecorator(mocks)],
props: {
inviteId: "1",
Expand Down
4 changes: 2 additions & 2 deletions src/modules/choose-team/components/Invite.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Invite, InviteModel } from "./Invite";
import { screen } from "@testing-library/react";
import { setComponent } from "../../../support/testing/testComponent";
import { setTestSubject } from "../../../support/testing/testSubject";
import { dataDecorator } from "../../../support/testing/testDecorators";

const invite: InviteModel = {
Expand All @@ -12,7 +12,7 @@ const invite: InviteModel = {
};

describe("<Invite />", () => {
const { renderComponent } = setComponent(Invite, {
const { renderComponent } = setTestSubject(Invite, {
decorators: [dataDecorator()],
props: { invite },
});
Expand Down
4 changes: 2 additions & 2 deletions src/modules/choose-team/components/InviteList.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { setComponent } from "../../../support/testing/testComponent";
import { setTestSubject } from "../../../support/testing/testSubject";
import { dataDecorator } from "../../../support/testing/testDecorators";
import { InviteList } from "./index";
import { GET_INVITES } from "./InviteList";
Expand Down Expand Up @@ -59,7 +59,7 @@ const mockWithoutInvites = [
];

describe("<InviteList />", () => {
const { renderComponent, updateDecorator } = setComponent(InviteList, {
const { renderComponent, updateDecorator } = setTestSubject(InviteList, {
decorators: [dataDecorator(mockWithInvites)],
props: {},
});
Expand Down
4 changes: 2 additions & 2 deletions src/modules/choose-team/components/TeamList.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { GET_TEAMS } from "./TeamList";
import { TeamList } from "./index";
import { screen } from "@testing-library/react";
import { setComponent } from "../../../support/testing/testComponent";
import { setTestSubject } from "../../../support/testing/testSubject";
import { dataDecorator } from "../../../support/testing/testDecorators";

const mocksWithInvite = [
Expand Down Expand Up @@ -61,7 +61,7 @@ const mocksWithError = [
];

describe("<TeamList />", () => {
const { renderComponent, updateDecorator } = setComponent(TeamList, {
const { renderComponent, updateDecorator } = setTestSubject(TeamList, {
decorators: [dataDecorator(mocksWithInvite)],
props: {},
});
Expand Down
4 changes: 2 additions & 2 deletions src/modules/choose-team/components/TeamRow.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import { createMemoryHistory, MemoryHistory } from "history";
import TeamRow from "./TeamRow";
import { Storage } from "../../../support/storage";
import { screen } from "@testing-library/react";
import { setComponent } from "../../../support/testing/testComponent";
import { setTestSubject } from "../../../support/testing/testSubject";
import { routingDecorator } from "../../../support/testing/testDecorators";

describe("<TeamRow />", () => {
let history: MemoryHistory;
const { renderComponent } = setComponent(TeamRow, {
const { renderComponent } = setTestSubject(TeamRow, {
decorators: [routingDecorator()],
props: {
id: "1",
Expand Down
4 changes: 2 additions & 2 deletions src/modules/feed/FeedPage.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { mocksWithData as teamMemberMocks } from "./components/UserDropdown/User
import { mocks as guidelineMocks } from "../manage-team/sections/guideline/GuidelinesSection.spec";
import { mocks as userMock } from "../../components/navigation/Desktop.spec";
import { mocks as goalMocks } from "../statistics/Statistics.spec";
import { setComponent } from "../../support/testing/testComponent";
import { setTestSubject } from "../../support/testing/testSubject";
import {
dataDecorator,
responsiveDecorator,
Expand All @@ -17,7 +17,7 @@ type MockRequest = { request: unknown; result: unknown };
describe("<FeedPage />", () => {
const teamId = "1";

const { renderComponent } = setComponent(FeedPage, {
const { renderComponent } = setTestSubject(FeedPage, {
decorators: [
responsiveDecorator,
dataDecorator(
Expand Down
6 changes: 3 additions & 3 deletions src/modules/feed/components/CreatePost/CreatePost.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import {
import { dataDecorator } from "../../../../support/testing/testDecorators";
import {
makeFC,
setComponent,
} from "../../../../support/testing/testComponent";
setTestSubject,
} from "../../../../support/testing/testSubject";

const mocks = () => [
{
Expand Down Expand Up @@ -126,7 +126,7 @@ const mocksWithError = [
];

describe("<CreatePost />", () => {
const { renderComponent, updateDecorator } = setComponent(
const { renderComponent, updateDecorator } = setTestSubject(
makeFC(CreatePost),
{
decorators: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import {
} from "../../../../support/testing/reactSelectHelpers";
import {
makeFC,
setComponent,
} from "../../../../support/testing/testComponent";
setTestSubject,
} from "../../../../support/testing/testSubject";
import { dataDecorator } from "../../../../support/testing/testDecorators";
import { GET_GUIDELINES } from "../../../manage-team/sections/guideline/GuidelinesSection";
import GuidelineInput from "./GuidelineInput";
Expand Down Expand Up @@ -69,7 +69,7 @@ const mocksWithoutData = [
describe("<GuidelineInput />", () => {
const handleChangeMock = jest.fn();

const { renderComponent, updateDecorator } = setComponent(
const { renderComponent, updateDecorator } = setTestSubject(
makeFC(GuidelineInput),
{
decorators: [dataDecorator(mocks)],
Expand Down
4 changes: 2 additions & 2 deletions src/modules/feed/components/RightRail.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { screen } from "@testing-library/react";
import { mockLocalstorage } from "../../../spec_helper";
import RightRail from "./RightRail";
import { mocks as goalMocks } from "../../statistics/Statistics.spec";
import { setComponent } from "../../../support/testing/testComponent";
import { setTestSubject } from "../../../support/testing/testSubject";
import { dataDecorator } from "../../../support/testing/testDecorators";

describe("<RightRail />", () => {
const { renderComponent } = setComponent(RightRail, {
const { renderComponent } = setTestSubject(RightRail, {
decorators: [dataDecorator(goalMocks("1"))],
props: {},
});
Expand Down
6 changes: 3 additions & 3 deletions src/modules/feed/components/Transaction/Header.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { FragmentPostResult, GET_POSTS } from "../../queries";
import { screen, waitFor } from "@testing-library/react";
import {
makeFC,
setComponent,
} from "../../../../support/testing/testComponent";
setTestSubject,
} from "../../../../support/testing/testSubject";
import { dataDecorator } from "../../../../support/testing/testDecorators";

const transaction: FragmentPostResult = {
Expand Down Expand Up @@ -86,7 +86,7 @@ const mocks = [
];

describe("<Header />", () => {
const { renderComponent, updateProps } = setComponent(makeFC(Header), {
const { renderComponent, updateProps } = setTestSubject(makeFC(Header), {
decorators: [dataDecorator(mocks)],
props: { transaction },
});
Expand Down
6 changes: 3 additions & 3 deletions src/modules/feed/components/Transaction/LikeButton.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { screen, waitFor } from "@testing-library/react";
import { InMemoryCache } from "@apollo/client";
import {
makeFC,
setComponent,
} from "../../../../support/testing/testComponent";
setTestSubject,
} from "../../../../support/testing/testSubject";
import { dataDecorator } from "../../../../support/testing/testDecorators";

const likedPost: FragmentPostResult = {
Expand Down Expand Up @@ -90,7 +90,7 @@ const mocks = [
];

describe("<LikeButton />", () => {
const { renderComponent, updateProps, updateDecorator } = setComponent(
const { renderComponent, updateProps, updateDecorator } = setTestSubject(
makeFC(LikeButton),
{
decorators: [dataDecorator(mocks)],
Expand Down
4 changes: 2 additions & 2 deletions src/modules/feed/components/Transaction/Transaction.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Transaction } from "./index";
import { FragmentPostResult } from "../../queries";
import { screen } from "@testing-library/react";
import { setComponent } from "../../../../support/testing/testComponent";
import { setTestSubject } from "../../../../support/testing/testSubject";
import { dataDecorator } from "../../../../support/testing/testDecorators";

const transaction: FragmentPostResult = {
Expand Down Expand Up @@ -38,7 +38,7 @@ const transactionWithVote = {
};

describe("Transaction", () => {
const { renderComponent } = setComponent(Transaction, {
const { renderComponent } = setTestSubject(Transaction, {
decorators: [dataDecorator()],
props: { transaction: transactionWithVote },
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import {
import userEvent from "@testing-library/user-event";
import {
makeFC,
setComponent,
} from "../../../../support/testing/testComponent";
setTestSubject,
} from "../../../../support/testing/testSubject";
import { dataDecorator } from "../../../../support/testing/testDecorators";

export const mocksWithData = (teamId: string) => [
Expand Down Expand Up @@ -78,7 +78,7 @@ const mocksWithoutData = (teamId: string) => [
const handleChangeMock = jest.fn();

describe("<DropdownRemote />", () => {
const { renderComponent, updateDecorator } = setComponent(
const { renderComponent, updateDecorator } = setTestSubject(
makeFC(DropdownRemote),
{
decorators: [dataDecorator(mocksWithData("1"))],
Expand Down
4 changes: 2 additions & 2 deletions src/modules/login/FinishForgotPasswordPage.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { GraphQLError } from "graphql";
import { MUTATION_NEW_PASSWORD } from "./FinishForgotPasswordPage";
import { RouterBypassFinishForgotPasswordPage as FinishForgotPasswordPage } from "./index";
import { fireEvent, screen, waitFor } from "@testing-library/react";
import { makeFC, setComponent } from "../../support/testing/testComponent";
import { makeFC, setTestSubject } from "../../support/testing/testSubject";
import { dataDecorator } from "../../support/testing/testDecorators";
import { createRouterProps } from "../../spec_helper";

Expand Down Expand Up @@ -53,7 +53,7 @@ const createLocationWithToken = (token: string) => ({
});

describe("<FinishForgotPasswordPage />", () => {
const { renderComponent, updateProps } = setComponent(
const { renderComponent, updateProps } = setTestSubject(
makeFC(FinishForgotPasswordPage),
{
decorators: [dataDecorator(mocks)],
Expand Down
Loading

0 comments on commit f8df070

Please sign in to comment.