diff --git a/src/components/AuthenticatedRoute.spec.tsx b/src/components/AuthenticatedRoute.spec.tsx index 754b7976..2764e7ef 100644 --- a/src/components/AuthenticatedRoute.spec.tsx +++ b/src/components/AuthenticatedRoute.spec.tsx @@ -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("", () => { - const { renderComponent, updateDecorator, updateProps } = setComponent( + const { renderComponent, updateDecorator, updateProps } = setTestSubject( AuthenticatedRoute, { decorators: [routingDecorator()], diff --git a/src/components/Circle/Circle.spec.tsx b/src/components/Circle/Circle.spec.tsx index a9f0e100..1b5d60c5 100644 --- a/src/components/Circle/Circle.spec.tsx +++ b/src/components/Circle/Circle.spec.tsx @@ -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("", () => { - const { setProps, renderComponent } = setComponent(CustomCircle); + const { setProps, renderComponent } = setTestSubject(CustomCircle); setProps({ percent: 50, currentKudos: 200, diff --git a/src/components/navigation/Desktop.spec.tsx b/src/components/navigation/Desktop.spec.tsx index 6e7ae6cc..3d816342 100644 --- a/src/components/navigation/Desktop.spec.tsx +++ b/src/components/navigation/Desktop.spec.tsx @@ -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, @@ -25,7 +25,7 @@ export const mocks = () => [ ]; describe("", () => { - const { renderComponent } = setComponent(Desktop, { + const { renderComponent } = setTestSubject(Desktop, { decorators: [dataDecorator(mocks()), routingDecorator()], props: {}, }); diff --git a/src/components/navigation/Mobile.spec.tsx b/src/components/navigation/Mobile.spec.tsx index 44823029..9c70e4de 100644 --- a/src/components/navigation/Mobile.spec.tsx +++ b/src/components/navigation/Mobile.spec.tsx @@ -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("", () => { mockLocalstorage("fakeToken"); - const { renderComponent } = setComponent(Mobile, { + const { renderComponent } = setTestSubject(Mobile, { decorators: [routingDecorator()], props: {}, }); diff --git a/src/components/organisms/RepoList/RepoList.spec.tsx b/src/components/organisms/RepoList/RepoList.spec.tsx index 219b7bd6..e89674ef 100644 --- a/src/components/organisms/RepoList/RepoList.spec.tsx +++ b/src/components/organisms/RepoList/RepoList.spec.tsx @@ -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) => [ @@ -81,7 +81,7 @@ const mocksWithError = [ ]; describe("", () => { - const { renderComponent, updateDecorator } = setComponent(RepoList, { + const { renderComponent, updateDecorator } = setTestSubject(RepoList, { decorators: [dataDecorator(mocks(false))], props: {}, }); diff --git a/src/components/upload/ImageUpload.spec.tsx b/src/components/upload/ImageUpload.spec.tsx index d6988f91..8b1edc76 100644 --- a/src/components/upload/ImageUpload.spec.tsx +++ b/src/components/upload/ImageUpload.spec.tsx @@ -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"; @@ -16,7 +16,7 @@ const createFile = (name: string, size: number, type: string): File => { describe("", () => { let selectedFiles: any = []; - const { setProps, renderComponent } = setComponent(ImageUpload); + const { setProps, renderComponent } = setTestSubject(ImageUpload); setProps({ onChange: (files) => { selectedFiles = files; diff --git a/src/modules/choose-team/ChooseTeamPage.spec.tsx b/src/modules/choose-team/ChooseTeamPage.spec.tsx index 848b93b8..0311a7f0 100644 --- a/src/modules/choose-team/ChooseTeamPage.spec.tsx +++ b/src/modules/choose-team/ChooseTeamPage.spec.tsx @@ -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(); @@ -86,7 +86,7 @@ const mockWithInvites = [ ]; describe("", () => { - const { renderComponent } = setComponent(Content, { + const { renderComponent } = setTestSubject(Content, { decorators: [dataDecorator(mockWithInvites)], props: {}, }); diff --git a/src/modules/choose-team/CreateTeamPage.spec.tsx b/src/modules/choose-team/CreateTeamPage.spec.tsx index 59ea5028..479c6b85 100644 --- a/src/modules/choose-team/CreateTeamPage.spec.tsx +++ b/src/modules/choose-team/CreateTeamPage.spec.tsx @@ -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, @@ -35,7 +35,7 @@ const mocksWithError = [ ]; describe("", () => { - const { renderComponent, updateDecorator } = setComponent(CreateTeamPage, { + const { renderComponent, updateDecorator } = setTestSubject(CreateTeamPage, { decorators: [dataDecorator(mocks), routingDecorator()], props: {}, }); diff --git a/src/modules/choose-team/components/ChoiceButton.spec.tsx b/src/modules/choose-team/components/ChoiceButton.spec.tsx index dca9b80c..a204b78c 100644 --- a/src/modules/choose-team/components/ChoiceButton.spec.tsx +++ b/src/modules/choose-team/components/ChoiceButton.spec.tsx @@ -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` @@ -39,7 +39,7 @@ jest.mock("react-router-dom", () => ({ })); describe("", () => { - const { renderComponent, updateProps } = setComponent(ChoiceButton, { + const { renderComponent, updateProps } = setTestSubject(ChoiceButton, { decorators: [dataDecorator(mocks)], props: { inviteId: "1", diff --git a/src/modules/choose-team/components/Invite.spec.tsx b/src/modules/choose-team/components/Invite.spec.tsx index a5987fad..a79f18bf 100644 --- a/src/modules/choose-team/components/Invite.spec.tsx +++ b/src/modules/choose-team/components/Invite.spec.tsx @@ -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 = { @@ -12,7 +12,7 @@ const invite: InviteModel = { }; describe("", () => { - const { renderComponent } = setComponent(Invite, { + const { renderComponent } = setTestSubject(Invite, { decorators: [dataDecorator()], props: { invite }, }); diff --git a/src/modules/choose-team/components/InviteList.spec.tsx b/src/modules/choose-team/components/InviteList.spec.tsx index 65695cad..5d24ec2f 100644 --- a/src/modules/choose-team/components/InviteList.spec.tsx +++ b/src/modules/choose-team/components/InviteList.spec.tsx @@ -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"; @@ -59,7 +59,7 @@ const mockWithoutInvites = [ ]; describe("", () => { - const { renderComponent, updateDecorator } = setComponent(InviteList, { + const { renderComponent, updateDecorator } = setTestSubject(InviteList, { decorators: [dataDecorator(mockWithInvites)], props: {}, }); diff --git a/src/modules/choose-team/components/TeamList.spec.tsx b/src/modules/choose-team/components/TeamList.spec.tsx index 590d5ef8..dd9447da 100644 --- a/src/modules/choose-team/components/TeamList.spec.tsx +++ b/src/modules/choose-team/components/TeamList.spec.tsx @@ -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 = [ @@ -61,7 +61,7 @@ const mocksWithError = [ ]; describe("", () => { - const { renderComponent, updateDecorator } = setComponent(TeamList, { + const { renderComponent, updateDecorator } = setTestSubject(TeamList, { decorators: [dataDecorator(mocksWithInvite)], props: {}, }); diff --git a/src/modules/choose-team/components/TeamRow.spec.tsx b/src/modules/choose-team/components/TeamRow.spec.tsx index 2822c03b..6c9effa5 100644 --- a/src/modules/choose-team/components/TeamRow.spec.tsx +++ b/src/modules/choose-team/components/TeamRow.spec.tsx @@ -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("", () => { let history: MemoryHistory; - const { renderComponent } = setComponent(TeamRow, { + const { renderComponent } = setTestSubject(TeamRow, { decorators: [routingDecorator()], props: { id: "1", diff --git a/src/modules/feed/FeedPage.spec.tsx b/src/modules/feed/FeedPage.spec.tsx index f33b2cf1..0009ba27 100644 --- a/src/modules/feed/FeedPage.spec.tsx +++ b/src/modules/feed/FeedPage.spec.tsx @@ -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, @@ -17,7 +17,7 @@ type MockRequest = { request: unknown; result: unknown }; describe("", () => { const teamId = "1"; - const { renderComponent } = setComponent(FeedPage, { + const { renderComponent } = setTestSubject(FeedPage, { decorators: [ responsiveDecorator, dataDecorator( diff --git a/src/modules/feed/components/CreatePost/CreatePost.spec.tsx b/src/modules/feed/components/CreatePost/CreatePost.spec.tsx index a3388872..eadb647d 100644 --- a/src/modules/feed/components/CreatePost/CreatePost.spec.tsx +++ b/src/modules/feed/components/CreatePost/CreatePost.spec.tsx @@ -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 = () => [ { @@ -126,7 +126,7 @@ const mocksWithError = [ ]; describe("", () => { - const { renderComponent, updateDecorator } = setComponent( + const { renderComponent, updateDecorator } = setTestSubject( makeFC(CreatePost), { decorators: [ diff --git a/src/modules/feed/components/GuidelineInput/GuidelineInput.spec.tsx b/src/modules/feed/components/GuidelineInput/GuidelineInput.spec.tsx index 17177780..946ccb42 100644 --- a/src/modules/feed/components/GuidelineInput/GuidelineInput.spec.tsx +++ b/src/modules/feed/components/GuidelineInput/GuidelineInput.spec.tsx @@ -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"; @@ -69,7 +69,7 @@ const mocksWithoutData = [ describe("", () => { const handleChangeMock = jest.fn(); - const { renderComponent, updateDecorator } = setComponent( + const { renderComponent, updateDecorator } = setTestSubject( makeFC(GuidelineInput), { decorators: [dataDecorator(mocks)], diff --git a/src/modules/feed/components/RightRail.spec.tsx b/src/modules/feed/components/RightRail.spec.tsx index e68a8f7b..a4280e6e 100644 --- a/src/modules/feed/components/RightRail.spec.tsx +++ b/src/modules/feed/components/RightRail.spec.tsx @@ -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("", () => { - const { renderComponent } = setComponent(RightRail, { + const { renderComponent } = setTestSubject(RightRail, { decorators: [dataDecorator(goalMocks("1"))], props: {}, }); diff --git a/src/modules/feed/components/Transaction/Header.spec.tsx b/src/modules/feed/components/Transaction/Header.spec.tsx index c85d88c2..3f4c40da 100644 --- a/src/modules/feed/components/Transaction/Header.spec.tsx +++ b/src/modules/feed/components/Transaction/Header.spec.tsx @@ -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 = { @@ -86,7 +86,7 @@ const mocks = [ ]; describe("
", () => { - const { renderComponent, updateProps } = setComponent(makeFC(Header), { + const { renderComponent, updateProps } = setTestSubject(makeFC(Header), { decorators: [dataDecorator(mocks)], props: { transaction }, }); diff --git a/src/modules/feed/components/Transaction/LikeButton.spec.tsx b/src/modules/feed/components/Transaction/LikeButton.spec.tsx index 0764e482..210414e8 100644 --- a/src/modules/feed/components/Transaction/LikeButton.spec.tsx +++ b/src/modules/feed/components/Transaction/LikeButton.spec.tsx @@ -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 = { @@ -90,7 +90,7 @@ const mocks = [ ]; describe("", () => { - const { renderComponent, updateProps, updateDecorator } = setComponent( + const { renderComponent, updateProps, updateDecorator } = setTestSubject( makeFC(LikeButton), { decorators: [dataDecorator(mocks)], diff --git a/src/modules/feed/components/Transaction/Transaction.spec.tsx b/src/modules/feed/components/Transaction/Transaction.spec.tsx index 73ba877d..0321de65 100644 --- a/src/modules/feed/components/Transaction/Transaction.spec.tsx +++ b/src/modules/feed/components/Transaction/Transaction.spec.tsx @@ -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 = { @@ -38,7 +38,7 @@ const transactionWithVote = { }; describe("Transaction", () => { - const { renderComponent } = setComponent(Transaction, { + const { renderComponent } = setTestSubject(Transaction, { decorators: [dataDecorator()], props: { transaction: transactionWithVote }, }); diff --git a/src/modules/feed/components/UserDropdown/UserDropdown.spec.tsx b/src/modules/feed/components/UserDropdown/UserDropdown.spec.tsx index a6067281..0fd2b5c7 100644 --- a/src/modules/feed/components/UserDropdown/UserDropdown.spec.tsx +++ b/src/modules/feed/components/UserDropdown/UserDropdown.spec.tsx @@ -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) => [ @@ -78,7 +78,7 @@ const mocksWithoutData = (teamId: string) => [ const handleChangeMock = jest.fn(); describe("", () => { - const { renderComponent, updateDecorator } = setComponent( + const { renderComponent, updateDecorator } = setTestSubject( makeFC(DropdownRemote), { decorators: [dataDecorator(mocksWithData("1"))], diff --git a/src/modules/login/FinishForgotPasswordPage.spec.tsx b/src/modules/login/FinishForgotPasswordPage.spec.tsx index 44633db3..db9f3304 100644 --- a/src/modules/login/FinishForgotPasswordPage.spec.tsx +++ b/src/modules/login/FinishForgotPasswordPage.spec.tsx @@ -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"; @@ -53,7 +53,7 @@ const createLocationWithToken = (token: string) => ({ }); describe("", () => { - const { renderComponent, updateProps } = setComponent( + const { renderComponent, updateProps } = setTestSubject( makeFC(FinishForgotPasswordPage), { decorators: [dataDecorator(mocks)], diff --git a/src/modules/login/ForgotPasswordPage.spec.tsx b/src/modules/login/ForgotPasswordPage.spec.tsx index ccbc5f68..cee80f09 100644 --- a/src/modules/login/ForgotPasswordPage.spec.tsx +++ b/src/modules/login/ForgotPasswordPage.spec.tsx @@ -2,7 +2,7 @@ import { GraphQLError } from "graphql"; import { ForgotPasswordPage } from "./index"; import { MUTATION_FORGOT_PASSWORD } from "./ForgotPasswordPage"; 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"; let mutationCalled = false; @@ -39,7 +39,7 @@ const mocks = [ ]; describe("", () => { - const { renderComponent } = setComponent(makeFC(ForgotPasswordPage), { + const { renderComponent } = setTestSubject(makeFC(ForgotPasswordPage), { decorators: [dataDecorator(mocks)], props: {}, }); diff --git a/src/modules/login/LoginPage.spec.tsx b/src/modules/login/LoginPage.spec.tsx index 0e0c3ec7..08e9cf38 100644 --- a/src/modules/login/LoginPage.spec.tsx +++ b/src/modules/login/LoginPage.spec.tsx @@ -2,7 +2,7 @@ import { GraphQLError } from "graphql"; import { LoginPage } from "./index"; import { MUTATION_LOGIN } from "./LoginPage"; import { fireEvent, screen, waitFor } from "@testing-library/react"; -import { makeFC, setComponent } from "../../support/testing/testComponent"; +import { makeFC, setTestSubject } from "../../support/testing/testSubject"; import { dataDecorator, routingDecorator, @@ -49,7 +49,7 @@ const mocks = [ ]; describe("", () => { - const { renderComponent } = setComponent(makeFC(LoginPage), { + const { renderComponent } = setTestSubject(makeFC(LoginPage), { decorators: [dataDecorator(mocks), routingDecorator()], props: {}, }); diff --git a/src/modules/login/RegisterPage.spec.tsx b/src/modules/login/RegisterPage.spec.tsx index ef82a9d0..f16df789 100644 --- a/src/modules/login/RegisterPage.spec.tsx +++ b/src/modules/login/RegisterPage.spec.tsx @@ -2,7 +2,7 @@ import { GraphQLError } from "graphql"; import { RegisterPage } from "./index"; import { MUTATION_REGISTER } from "./RegisterPage"; import { fireEvent, screen, waitFor } from "@testing-library/react"; -import { makeFC, setComponent } from "../../support/testing/testComponent"; +import { makeFC, setTestSubject } from "../../support/testing/testSubject"; import { dataDecorator, routingDecorator, @@ -51,7 +51,7 @@ const mocks = [ ]; describe("", () => { - const { renderComponent } = setComponent(makeFC(RegisterPage), { + const { renderComponent } = setTestSubject(makeFC(RegisterPage), { decorators: [dataDecorator(mocks), routingDecorator()], props: {}, }); diff --git a/src/modules/manage-team/ManageTeamPage.spec.tsx b/src/modules/manage-team/ManageTeamPage.spec.tsx index 67b6bfbe..6c1bef00 100644 --- a/src/modules/manage-team/ManageTeamPage.spec.tsx +++ b/src/modules/manage-team/ManageTeamPage.spec.tsx @@ -1,14 +1,14 @@ import { createMemoryHistory, MemoryHistory } from "history"; import { ManageTeamPage } from "./ManageTeamPage"; import { screen } from "@testing-library/react"; -import { makeFC, setComponent } from "../../support/testing/testComponent"; +import { makeFC, setTestSubject } from "../../support/testing/testSubject"; import { routingDecorator } from "../../support/testing/testDecorators"; import { createRouterProps } from "../../spec_helper"; describe("", () => { let history: MemoryHistory; - const { setProps, renderComponent } = setComponent(makeFC(ManageTeamPage), { + const { setProps, renderComponent } = setTestSubject(makeFC(ManageTeamPage), { decorators: [routingDecorator()], }); diff --git a/src/modules/manage-team/sections/General.spec.tsx b/src/modules/manage-team/sections/General.spec.tsx index e308d708..87c67614 100644 --- a/src/modules/manage-team/sections/General.spec.tsx +++ b/src/modules/manage-team/sections/General.spec.tsx @@ -1,5 +1,5 @@ import { mockLocalstorage } from "../../../spec_helper"; -import { makeFC, setComponent } from "../../../support/testing/testComponent"; +import { makeFC, setTestSubject } from "../../../support/testing/testSubject"; import { dataDecorator } from "../../../support/testing/testDecorators"; import GeneralSection, { GET_TEAM_NAME, UPDATE_TEAM } from "./General"; import { fireEvent, screen, waitFor } from "@testing-library/react"; @@ -63,7 +63,7 @@ const mocksWithError = [ ]; describe("", () => { - const { renderComponent, updateDecorator } = setComponent( + const { renderComponent, updateDecorator } = setTestSubject( makeFC(GeneralSection), { decorators: [dataDecorator(mocks)], props: {} }, ); diff --git a/src/modules/manage-team/sections/guideline/EditGuideline.spec.tsx b/src/modules/manage-team/sections/guideline/EditGuideline.spec.tsx index 38ae0388..408d7fd7 100644 --- a/src/modules/manage-team/sections/guideline/EditGuideline.spec.tsx +++ b/src/modules/manage-team/sections/guideline/EditGuideline.spec.tsx @@ -1,8 +1,8 @@ import { mockLocalstorage } from "../../../../spec_helper"; import { makeFC, - setComponent, -} from "../../../../support/testing/testComponent"; + setTestSubject, +} from "../../../../support/testing/testSubject"; import { dataDecorator } from "../../../../support/testing/testDecorators"; import { EditGuideline } from "./EditGuideline"; import { @@ -91,10 +91,13 @@ const mocks = [ ]; describe("", () => { - const { renderComponent, updateProps } = setComponent(makeFC(EditGuideline), { - decorators: [dataDecorator(mocks)], - props: {}, - }); + const { renderComponent, updateProps } = setTestSubject( + makeFC(EditGuideline), + { + decorators: [dataDecorator(mocks)], + props: {}, + }, + ); beforeEach(() => { mockLocalstorage("1"); diff --git a/src/modules/manage-team/sections/guideline/Guideline.spec.tsx b/src/modules/manage-team/sections/guideline/Guideline.spec.tsx index 4c8f5373..3832570f 100644 --- a/src/modules/manage-team/sections/guideline/Guideline.spec.tsx +++ b/src/modules/manage-team/sections/guideline/Guideline.spec.tsx @@ -1,5 +1,5 @@ import { MockedFunction, mockLocalstorage } from "../../../../spec_helper"; -import { setComponent } from "../../../../support/testing/testComponent"; +import { setTestSubject } from "../../../../support/testing/testSubject"; import { dataDecorator, tableDecorator, @@ -66,7 +66,7 @@ const guideline = { describe("", () => { const editGuidelineMock = jest.fn(); - const { renderComponent } = setComponent(Guideline, { + const { renderComponent } = setTestSubject(Guideline, { decorators: [tableDecorator, dataDecorator(mocks)], props: { key: guideline.key, diff --git a/src/modules/manage-team/sections/guideline/GuidelinesSection.spec.tsx b/src/modules/manage-team/sections/guideline/GuidelinesSection.spec.tsx index be7522fc..17a0938a 100644 --- a/src/modules/manage-team/sections/guideline/GuidelinesSection.spec.tsx +++ b/src/modules/manage-team/sections/guideline/GuidelinesSection.spec.tsx @@ -1,8 +1,8 @@ import { mockLocalstorage } from "../../../../spec_helper"; import { makeFC, - setComponent, -} from "../../../../support/testing/testComponent"; + setTestSubject, +} from "../../../../support/testing/testSubject"; import { dataDecorator } from "../../../../support/testing/testDecorators"; import GuidelineSection, { GET_GUIDELINES } from "./GuidelinesSection"; import { screen } from "@testing-library/react"; @@ -49,7 +49,7 @@ const errorMocks = [ ]; describe("", () => { - const { renderComponent, updateDecorator } = setComponent( + const { renderComponent, updateDecorator } = setTestSubject( makeFC(GuidelineSection), { decorators: [dataDecorator(mocks("1"))], props: {} }, ); diff --git a/src/modules/manage-team/sections/integrations/Integrations.spec.tsx b/src/modules/manage-team/sections/integrations/Integrations.spec.tsx index cb1871a9..b9224c71 100644 --- a/src/modules/manage-team/sections/integrations/Integrations.spec.tsx +++ b/src/modules/manage-team/sections/integrations/Integrations.spec.tsx @@ -7,8 +7,8 @@ import IntegrationsSection, { 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"; let mutationCalled = false; @@ -86,7 +86,7 @@ const mocksWithError = [ ]; describe("", () => { - const { renderComponent, updateDecorator } = setComponent( + const { renderComponent, updateDecorator } = setTestSubject( makeFC(IntegrationsSection), { decorators: [dataDecorator(mocksWithoutSlack)], diff --git a/src/modules/manage-team/sections/invite/CreateInvite.spec.tsx b/src/modules/manage-team/sections/invite/CreateInvite.spec.tsx index 1aefba3a..55f62b9f 100644 --- a/src/modules/manage-team/sections/invite/CreateInvite.spec.tsx +++ b/src/modules/manage-team/sections/invite/CreateInvite.spec.tsx @@ -4,8 +4,8 @@ import { QUERY_GET_INVITES } from "./InvitesSection"; import { fireEvent, screen, waitFor } from "@testing-library/react"; import { makeFC, - setComponent, -} from "../../../../support/testing/testComponent"; + setTestSubject, +} from "../../../../support/testing/testSubject"; import { dataDecorator } from "../../../../support/testing/testDecorators"; let mutationCalled = false; @@ -61,7 +61,7 @@ const mocks = [ describe("", () => { const mockRefetch = jest.fn(); - const { renderComponent } = setComponent(makeFC(CreateInvite), { + const { renderComponent } = setTestSubject(makeFC(CreateInvite), { decorators: [dataDecorator(mocks)], props: { refetch: mockRefetch, diff --git a/src/modules/manage-team/sections/invite/Invite.spec.tsx b/src/modules/manage-team/sections/invite/Invite.spec.tsx index 77faa900..e1b70b64 100644 --- a/src/modules/manage-team/sections/invite/Invite.spec.tsx +++ b/src/modules/manage-team/sections/invite/Invite.spec.tsx @@ -1,5 +1,5 @@ import { MockedFunction, mockLocalstorage } from "../../../../spec_helper"; -import { setComponent } from "../../../../support/testing/testComponent"; +import { setTestSubject } from "../../../../support/testing/testSubject"; import { dataDecorator, tableDecorator, @@ -80,7 +80,7 @@ const mocks = [ describe("", () => { const mockRefetch = jest.fn(); - const { renderComponent, updateProps } = setComponent(Invite, { + const { renderComponent, updateProps } = setTestSubject(Invite, { decorators: [tableDecorator, dataDecorator(mocks)], props: { invite: pendingInvite, diff --git a/src/modules/manage-team/sections/invite/InviteSection.spec.tsx b/src/modules/manage-team/sections/invite/InviteSection.spec.tsx index 8fc1eba3..f682eb33 100644 --- a/src/modules/manage-team/sections/invite/InviteSection.spec.tsx +++ b/src/modules/manage-team/sections/invite/InviteSection.spec.tsx @@ -1,5 +1,5 @@ import { mockLocalstorage } from "../../../../spec_helper"; -import { setComponent } from "../../../../support/testing/testComponent"; +import { setTestSubject } from "../../../../support/testing/testSubject"; import { dataDecorator } from "../../../../support/testing/testDecorators"; import InviteSection, { QUERY_GET_INVITES } from "./InvitesSection"; import { screen, waitFor } from "@testing-library/react"; @@ -46,7 +46,7 @@ const mocksWithError = [ ]; describe("", () => { - const { renderComponent, updateDecorator } = setComponent(InviteSection, { + const { renderComponent, updateDecorator } = setTestSubject(InviteSection, { decorators: [dataDecorator(mocks)], props: {}, }); diff --git a/src/modules/manage-team/sections/kudometer/KudometerRow.spec.tsx b/src/modules/manage-team/sections/kudometer/KudometerRow.spec.tsx index 78d37677..5cdb78fe 100644 --- a/src/modules/manage-team/sections/kudometer/KudometerRow.spec.tsx +++ b/src/modules/manage-team/sections/kudometer/KudometerRow.spec.tsx @@ -8,7 +8,7 @@ import { } from "./KudometerQueries"; import { GET_GOAL_PERCENTAGE } from "../../../feed/queries"; import { screen, waitFor } from "@testing-library/react"; -import { setComponent } from "../../../../support/testing/testComponent"; +import { setTestSubject } from "../../../../support/testing/testSubject"; import { dataDecorator, tableDecorator, @@ -114,7 +114,7 @@ const deleteHandler = jest.fn(); const editHandler = jest.fn(); describe("", () => { - const { renderComponent, updateProps } = setComponent(KudometerRow, { + const { renderComponent, updateProps } = setTestSubject(KudometerRow, { decorators: [tableDecorator, dataDecorator(mocks)], props: { key: "1", diff --git a/src/modules/manage-team/sections/kudometer/KudometerSection.spec.tsx b/src/modules/manage-team/sections/kudometer/KudometerSection.spec.tsx index 09ea72a2..5d4b0200 100644 --- a/src/modules/manage-team/sections/kudometer/KudometerSection.spec.tsx +++ b/src/modules/manage-team/sections/kudometer/KudometerSection.spec.tsx @@ -8,8 +8,8 @@ import { import { fireEvent, screen, waitFor } from "@testing-library/react"; import { makeFC, - setComponent, -} from "../../../../support/testing/testComponent"; + setTestSubject, +} from "../../../../support/testing/testSubject"; import { dataDecorator } from "../../../../support/testing/testDecorators"; let createMutationCalled = false; @@ -144,7 +144,7 @@ const mocksWithoutData = [ ]; describe("", () => { - const { renderComponent, updateDecorator } = setComponent( + const { renderComponent, updateDecorator } = setTestSubject( makeFC(KudometerSection), { decorators: [dataDecorator(mocks)], props: {} }, ); diff --git a/src/modules/manage-team/sections/kudometer/goals/EditGoal.spec.tsx b/src/modules/manage-team/sections/kudometer/goals/EditGoal.spec.tsx index 43a608e2..bc2a6c86 100644 --- a/src/modules/manage-team/sections/kudometer/goals/EditGoal.spec.tsx +++ b/src/modules/manage-team/sections/kudometer/goals/EditGoal.spec.tsx @@ -5,8 +5,8 @@ import { fireEvent, screen, waitFor } from "@testing-library/react"; import { createRef } from "react"; import { makeFC, - setComponent, -} from "../../../../../support/testing/testComponent"; + setTestSubject, +} from "../../../../../support/testing/testSubject"; import { dataDecorator } from "../../../../../support/testing/testDecorators"; let createMutationCalled = false; @@ -103,7 +103,7 @@ const mocksWithErrors = [ ]; describe("", () => { - const { renderComponent, updateProps, updateDecorator } = setComponent( + const { renderComponent, updateProps, updateDecorator } = setTestSubject( makeFC(EditGoal), { decorators: [dataDecorator(mocks)], props: { kudometerId: "1" } }, ); diff --git a/src/modules/manage-team/sections/kudometer/goals/GoalRow.spec.tsx b/src/modules/manage-team/sections/kudometer/goals/GoalRow.spec.tsx index f8edc3d1..63d39249 100644 --- a/src/modules/manage-team/sections/kudometer/goals/GoalRow.spec.tsx +++ b/src/modules/manage-team/sections/kudometer/goals/GoalRow.spec.tsx @@ -2,7 +2,7 @@ import { MockedFunction, mockLocalstorage } from "../../../../../spec_helper"; import { GoalRow } from "./GoalRow"; import { DELETE_GOAL, GET_KUDOMETERS, Goal } from "../KudometerQueries"; import { screen, waitFor } from "@testing-library/react"; -import { setComponent } from "../../../../../support/testing/testComponent"; +import { setTestSubject } from "../../../../../support/testing/testSubject"; import { dataDecorator, tableDecorator, @@ -69,7 +69,7 @@ const goal: Goal = { describe("", () => { const editGoalMock = jest.fn(() => 1); - const { renderComponent } = setComponent(GoalRow, { + const { renderComponent } = setTestSubject(GoalRow, { decorators: [tableDecorator, dataDecorator(mocks)], props: { key: goal.id, diff --git a/src/modules/manage-team/sections/kudometer/goals/Goals.spec.tsx b/src/modules/manage-team/sections/kudometer/goals/Goals.spec.tsx index 493b092b..e39d8337 100644 --- a/src/modules/manage-team/sections/kudometer/goals/Goals.spec.tsx +++ b/src/modules/manage-team/sections/kudometer/goals/Goals.spec.tsx @@ -3,8 +3,8 @@ import { Goal, Kudometer } from "../KudometerQueries"; import { screen } from "@testing-library/react"; import { makeFC, - setComponent, -} from "../../../../../support/testing/testComponent"; + setTestSubject, +} from "../../../../../support/testing/testSubject"; import { dataDecorator } from "../../../../../support/testing/testDecorators"; const goals: Goal[] = [ @@ -32,7 +32,7 @@ const kudometer: Kudometer = { }; describe("", () => { - const { renderComponent } = setComponent(makeFC(Goals), { + const { renderComponent } = setTestSubject(makeFC(Goals), { decorators: [dataDecorator()], props: { kudometer }, }); diff --git a/src/modules/manage-team/sections/member/AlterRoleButton.spec.tsx b/src/modules/manage-team/sections/member/AlterRoleButton.spec.tsx index e46ae1a9..7e4b6922 100644 --- a/src/modules/manage-team/sections/member/AlterRoleButton.spec.tsx +++ b/src/modules/manage-team/sections/member/AlterRoleButton.spec.tsx @@ -1,5 +1,5 @@ import { mockLocalstorage } from "../../../../spec_helper"; -import { setComponent } from "../../../../support/testing/testComponent"; +import { setTestSubject } from "../../../../support/testing/testSubject"; import { dataDecorator } from "../../../../support/testing/testDecorators"; import { AlterRoleButton, AlterRoleButtonMode } from "./AlterRoleButton"; import { ALTER_ROLE } from "./Members"; @@ -55,7 +55,7 @@ const mocks = [ const refetch = jest.fn(); describe("", () => { - const { renderComponent, updateProps } = setComponent(AlterRoleButton, { + const { renderComponent, updateProps } = setTestSubject(AlterRoleButton, { decorators: [dataDecorator(mocks)], props: { refetch, diff --git a/src/modules/manage-team/sections/member/MemberRow.spec.tsx b/src/modules/manage-team/sections/member/MemberRow.spec.tsx index cff69fdd..516f9b71 100644 --- a/src/modules/manage-team/sections/member/MemberRow.spec.tsx +++ b/src/modules/manage-team/sections/member/MemberRow.spec.tsx @@ -1,5 +1,5 @@ import { MockedFunction, mockLocalstorage } from "../../../../spec_helper"; -import { setComponent } from "../../../../support/testing/testComponent"; +import { setTestSubject } from "../../../../support/testing/testSubject"; import { dataDecorator, tableDecorator, @@ -41,7 +41,7 @@ const mocks = [ const refetch = jest.fn(); describe("", () => { - const { renderComponent } = setComponent(MemberRow, { + const { renderComponent } = setTestSubject(MemberRow, { decorators: [tableDecorator, dataDecorator(mocks)], props: { key: "1", diff --git a/src/modules/manage-team/sections/member/Members.spec.tsx b/src/modules/manage-team/sections/member/Members.spec.tsx index 27938c19..b230f8ea 100644 --- a/src/modules/manage-team/sections/member/Members.spec.tsx +++ b/src/modules/manage-team/sections/member/Members.spec.tsx @@ -1,8 +1,8 @@ import { mockLocalstorage } from "../../../../spec_helper"; import { makeFC, - setComponent, -} from "../../../../support/testing/testComponent"; + setTestSubject, +} from "../../../../support/testing/testSubject"; import { dataDecorator } from "../../../../support/testing/testDecorators"; import MemberSection, { GET_USERS } from "./Members"; import { screen, waitFor } from "@testing-library/react"; @@ -53,7 +53,7 @@ const mocksWithError = [ ]; describe("", () => { - const { renderComponent, updateDecorator } = setComponent( + const { renderComponent, updateDecorator } = setTestSubject( makeFC(MemberSection), { decorators: [dataDecorator(mocks())], props: {} }, ); diff --git a/src/modules/settings/InvitePage.spec.tsx b/src/modules/settings/InvitePage.spec.tsx index 518a81dc..b622efd7 100644 --- a/src/modules/settings/InvitePage.spec.tsx +++ b/src/modules/settings/InvitePage.spec.tsx @@ -1,10 +1,10 @@ -import { setComponent } from "../../support/testing/testComponent"; +import { setTestSubject } from "../../support/testing/testSubject"; import { dataDecorator } from "../../support/testing/testDecorators"; import { InvitePage } from "./InvitePage"; import { screen } from "@testing-library/react"; describe("", () => { - const { renderComponent } = setComponent(InvitePage, { + const { renderComponent } = setTestSubject(InvitePage, { decorators: [dataDecorator()], props: {}, }); diff --git a/src/modules/settings/SettingsPage.spec.tsx b/src/modules/settings/SettingsPage.spec.tsx index e53bb01b..ed6fec93 100644 --- a/src/modules/settings/SettingsPage.spec.tsx +++ b/src/modules/settings/SettingsPage.spec.tsx @@ -1,5 +1,5 @@ import { mockLocalstorage } from "../../spec_helper"; -import { setComponent } from "../../support/testing/testComponent"; +import { setTestSubject } from "../../support/testing/testSubject"; import { dataDecorator, routingDecorator, @@ -8,7 +8,7 @@ import { SettingsPage } from "./index"; import { screen } from "@testing-library/react"; describe("", () => { - const { renderComponent } = setComponent(SettingsPage, { + const { renderComponent } = setTestSubject(SettingsPage, { decorators: [dataDecorator(), routingDecorator()], props: {}, }); diff --git a/src/modules/statistics/Statistics.spec.tsx b/src/modules/statistics/Statistics.spec.tsx index fe640604..2694270a 100644 --- a/src/modules/statistics/Statistics.spec.tsx +++ b/src/modules/statistics/Statistics.spec.tsx @@ -1,5 +1,5 @@ import { mockLocalstorage } from "../../spec_helper"; -import { setComponent } from "../../support/testing/testComponent"; +import { setTestSubject } from "../../support/testing/testSubject"; import { dataDecorator } from "../../support/testing/testDecorators"; import Statistics, { GET_GOAL_PERCENTAGE } from "./Statistics"; import { screen, waitFor, within } from "@testing-library/react"; @@ -39,7 +39,7 @@ export const mocks = (teamId: string) => [ ]; describe("", () => { - const { renderComponent } = setComponent(Statistics, { + const { renderComponent } = setTestSubject(Statistics, { decorators: [dataDecorator(mocks("1"))], props: {}, }); diff --git a/src/modules/user/ResetPasswordPage.spec.tsx b/src/modules/user/ResetPasswordPage.spec.tsx index 9af653e1..8b373dc9 100644 --- a/src/modules/user/ResetPasswordPage.spec.tsx +++ b/src/modules/user/ResetPasswordPage.spec.tsx @@ -1,4 +1,4 @@ -import { makeFC, setComponent } from "../../support/testing/testComponent"; +import { makeFC, setTestSubject } from "../../support/testing/testSubject"; import { dataDecorator, routingDecorator, @@ -26,7 +26,7 @@ const mocks = [ ]; describe("", () => { - const { renderComponent } = setComponent(makeFC(ResetPasswordPage), { + const { renderComponent } = setTestSubject(makeFC(ResetPasswordPage), { decorators: [dataDecorator(mocks), routingDecorator()], props: {}, }); diff --git a/src/modules/user/UserPage.spec.tsx b/src/modules/user/UserPage.spec.tsx index 3ccae73f..85e6207e 100644 --- a/src/modules/user/UserPage.spec.tsx +++ b/src/modules/user/UserPage.spec.tsx @@ -3,7 +3,7 @@ import { DISCONNECT_SLACK, GET_USER, UserPage } from "./UserPage"; import { createRouterProps, mockLocalstorage } from "../../spec_helper"; import { PATH_RESET_PASSWORD } from "../../routes"; import { screen, waitFor, within } from "@testing-library/react"; -import { makeFC, setComponent } from "../../support/testing/testComponent"; +import { makeFC, setTestSubject } from "../../support/testing/testSubject"; import { dataDecorator } from "../../support/testing/testDecorators"; let mutationCalled = false; @@ -62,7 +62,7 @@ const mocksWithSlackId = [ ]; describe("", () => { - const { renderComponent, setProps, updateDecorator } = setComponent( + const { renderComponent, setProps, updateDecorator } = setTestSubject( makeFC(UserPage), { decorators: [dataDecorator(mocks())] }, ); diff --git a/src/support/testing/testDecorators.tsx b/src/support/testing/testDecorators.tsx index 1e6ee44b..9f0555b7 100644 --- a/src/support/testing/testDecorators.tsx +++ b/src/support/testing/testDecorators.tsx @@ -1,4 +1,4 @@ -import { Decorator } from "./testComponent"; +import { Decorator } from "./testSubject"; import { MockedProvider } from "@apollo/client/testing"; import { MemoryRouter, Route } from "react-router-dom"; import { ApolloCache } from "@apollo/client/cache"; diff --git a/src/support/testing/testComponent.tsx b/src/support/testing/testSubject.tsx similarity index 95% rename from src/support/testing/testComponent.tsx rename to src/support/testing/testSubject.tsx index 031254c7..c9e0a38f 100644 --- a/src/support/testing/testComponent.tsx +++ b/src/support/testing/testSubject.tsx @@ -37,7 +37,7 @@ type TestHelpers< * Render the component wrapped with all decorators, applying * all property and decorator setting updates. */ - renderComponent(): RenderResult; + renderComponent(): Promise; }; export type Decorator< @@ -53,7 +53,7 @@ export type Decorator< */ settings: TSettings; /** - * Function do decorate incoming `Component`. This can be part of a larger chain. + * Function to decorate incoming `Component`. This can be part of a larger chain. * * @param Component The component to decorate * @param settings settings to apply on the decoration @@ -92,7 +92,7 @@ const hasAlreadyRendered = ( * @param settings * @returns */ -export const setComponent = < +export const setTestSubject = < TComponent extends React.FC, TDecorators extends Decorator[], >( @@ -125,7 +125,8 @@ export const setComponent = < let lastRender: RenderResult | null = null; return { - renderComponent: () => { + // eslint-disable-next-line require-await + renderComponent: async () => { if (initialProps === null) { throw new Error("No props specified with setProps"); } @@ -195,6 +196,6 @@ export const makeFC = ( InstanceType>, TComponentProps >((props, ref) => ); - fc.displayName = "WrappedClassComponent"; + fc.displayName = `Wrapped${Component.displayName ?? Component.name}`; return fc; }; diff --git a/src/ui/Card/Card.spec.tsx b/src/ui/Card/Card.spec.tsx index ee637615..60c73277 100644 --- a/src/ui/Card/Card.spec.tsx +++ b/src/ui/Card/Card.spec.tsx @@ -1,9 +1,9 @@ import { screen } from "@testing-library/react"; import { Card } from "."; -import { setComponent } from "../../support/testing/testComponent"; +import { setTestSubject } from "../../support/testing/testSubject"; describe("Card", () => { - const { renderComponent, updateProps } = setComponent(Card, { + const { renderComponent, updateProps } = setTestSubject(Card, { props: { title: { text: "Kudometer" }, content: "content", diff --git a/src/ui/Dropdown/Dropdown.spec.tsx b/src/ui/Dropdown/Dropdown.spec.tsx index 54c8b640..d59aa132 100644 --- a/src/ui/Dropdown/Dropdown.spec.tsx +++ b/src/ui/Dropdown/Dropdown.spec.tsx @@ -1,6 +1,6 @@ import { screen, fireEvent } from "@testing-library/react"; import { Dropdown, DropdownMenuItem } from "."; -import { Decorator, setComponent } from "../../support/testing/testComponent"; +import { Decorator, setTestSubject } from "../../support/testing/testSubject"; const dropdownDecorator: Decorator<"dropdown"> = { name: "dropdown", @@ -13,7 +13,7 @@ const dropdownDecorator: Decorator<"dropdown"> = { }; describe("Dropdown Component", () => { - const { renderComponent, updateProps } = setComponent(DropdownMenuItem, { + const { renderComponent, updateProps } = setTestSubject(DropdownMenuItem, { decorators: [dropdownDecorator], props: { label: "Item 1", diff --git a/src/ui/Dropzone/index.spec.tsx b/src/ui/Dropzone/index.spec.tsx index 56ac81b3..25fbf5f0 100644 --- a/src/ui/Dropzone/index.spec.tsx +++ b/src/ui/Dropzone/index.spec.tsx @@ -1,9 +1,9 @@ import { screen } from "@testing-library/react"; -import { setComponent } from "../../support/testing/testComponent"; +import { setTestSubject } from "../../support/testing/testSubject"; import Dropzone from "."; describe("", () => { - const { renderComponent } = setComponent(Dropzone, { + const { renderComponent } = setTestSubject(Dropzone, { props: { label: "Drop it!" }, }); diff --git a/src/ui/InputField/InputField.spec.tsx b/src/ui/InputField/InputField.spec.tsx index 3448f9db..ed6e12a1 100644 --- a/src/ui/InputField/InputField.spec.tsx +++ b/src/ui/InputField/InputField.spec.tsx @@ -1,9 +1,9 @@ -import { render, screen } from "@testing-library/react"; +import { screen } from "@testing-library/react"; import InputField from "."; -import { setComponent } from "../../support/testing/testComponent"; +import { setTestSubject } from "../../support/testing/testSubject"; describe("InputField", () => { - const { renderComponent, updateProps } = setComponent(InputField, { + const { renderComponent, updateProps } = setTestSubject(InputField, { props: { id: "input", label: "Enter some text",