diff --git a/imports/plugins/core/graphql/lib/hocs/withCatalogItems.test.js b/imports/plugins/core/graphql/lib/hocs/withCatalogItems.test.js index a97bcf253c1..f6a9e766dcd 100644 --- a/imports/plugins/core/graphql/lib/hocs/withCatalogItems.test.js +++ b/imports/plugins/core/graphql/lib/hocs/withCatalogItems.test.js @@ -1,6 +1,7 @@ import React from "react"; +import { act } from "react-dom/test-utils"; import { mount } from "enzyme"; -import { MockedProvider } from "react-apollo/test-utils"; +import { MockedProvider } from "@apollo/react-testing"; import waitForFalseyProp from "/imports/test-utils/helpers/waitForFalseyProp"; import getCatalogItems from "../queries/getCatalogItems"; import withCatalogItems from "./withCatalogItems"; @@ -105,11 +106,14 @@ const mocks = [ ]; test("renders child component with correct catalogItems connection", async () => { - const wrapper = mount(( - - - - )); + let wrapper; + act(() => { + wrapper = mount(( + + + + )); + }); await waitForFalseyProp(wrapper, "MockComponent", "isLoadingCatalogItems"); @@ -120,11 +124,14 @@ test("renders child component with correct catalogItems connection", async () => }); test("doesn't query GraphQL if no shopId is provided", async () => { - const wrapper = mount(( - - - - )); + let wrapper; + act(() => { + wrapper = mount(( + + + + )); + }); const mockComponentInstance = wrapper.find("MockComponent"); expect(mockComponentInstance.prop("catalogItems")).toBe(undefined); @@ -132,11 +139,14 @@ test("doesn't query GraphQL if no shopId is provided", async () => { }); test("returns an empty array for catalogItems if invalid shopId is provided", async () => { - const wrapper = mount(( - - - - )); + let wrapper; + act(() => { + wrapper = mount(( + + + + )); + }); await waitForFalseyProp(wrapper, "MockComponent", "isLoadingCatalogItems"); diff --git a/imports/plugins/core/graphql/lib/hocs/withPrimaryShopId.test.js b/imports/plugins/core/graphql/lib/hocs/withPrimaryShopId.test.js index 8bab8fcfbe4..cea94d7a30a 100644 --- a/imports/plugins/core/graphql/lib/hocs/withPrimaryShopId.test.js +++ b/imports/plugins/core/graphql/lib/hocs/withPrimaryShopId.test.js @@ -1,6 +1,7 @@ import React from "react"; +import { act } from "react-dom/test-utils"; import { mount } from "enzyme"; -import { MockedProvider } from "react-apollo/test-utils"; +import { MockedProvider } from "@apollo/react-testing"; import waitForFalseyProp from "/imports/test-utils/helpers/waitForFalseyProp"; import getPrimaryShopId from "../queries/getPrimaryShopId"; import withPrimaryShopId from "./withPrimaryShopId"; @@ -19,11 +20,12 @@ test("renders child component with correct shop id", async () => { } }]; - const wrapper = mount(( - + let wrapper; + act(() => { + wrapper = mount( - - )); + ); + }); await waitForFalseyProp(wrapper, "MockComponent", "isLoadingPrimaryShopId"); diff --git a/imports/plugins/core/graphql/lib/hocs/withShopId.test.js b/imports/plugins/core/graphql/lib/hocs/withShopId.test.js index 362d15ea132..eae2d7d8aba 100644 --- a/imports/plugins/core/graphql/lib/hocs/withShopId.test.js +++ b/imports/plugins/core/graphql/lib/hocs/withShopId.test.js @@ -1,6 +1,7 @@ import React from "react"; +import { act } from "react-dom/test-utils"; import { mount } from "enzyme"; -import { MockedProvider } from "react-apollo/test-utils"; +import { MockedProvider } from "@apollo/react-testing"; import waitForFalseyProp from "/imports/test-utils/helpers/waitForFalseyProp"; import getShopId from "../queries/getShopId"; import withShopId from "./withShopId"; @@ -40,11 +41,14 @@ const mocks = [ ]; test("renders child component with correct shop id", async () => { - const wrapper = mount(( - - - - )); + let wrapper; + act(() => { + wrapper = mount(( + + + + )); + }); await waitForFalseyProp(wrapper, "MockComponent", "isLoadingShopId"); @@ -52,11 +56,14 @@ test("renders child component with correct shop id", async () => { }); test("doesn't query GraphQL if no shopSlug is provided", () => { - const wrapper = mount(( - - - - )); + let wrapper; + act(() => { + wrapper = mount(( + + + + )); + }); const mockComponentInstance = wrapper.find("MockComponent"); expect(mockComponentInstance.prop("shopId")).toBe(undefined); @@ -64,11 +71,14 @@ test("doesn't query GraphQL if no shopSlug is provided", () => { }); test("passes shouldSkipGraphql to child component if invalid shopSlug is provided", async () => { - const wrapper = mount(( - - - - )); + let wrapper; + act(() => { + wrapper = mount(( + + + + )); + }); await waitForFalseyProp(wrapper, "MockComponent", "isLoadingShopId"); diff --git a/imports/plugins/core/graphql/lib/hocs/withTagId.test.js b/imports/plugins/core/graphql/lib/hocs/withTagId.test.js index bfeccdb939c..dacd8cb0897 100644 --- a/imports/plugins/core/graphql/lib/hocs/withTagId.test.js +++ b/imports/plugins/core/graphql/lib/hocs/withTagId.test.js @@ -1,6 +1,7 @@ import React from "react"; +import { act } from "react-dom/test-utils"; import { mount } from "enzyme"; -import { MockedProvider } from "react-apollo/test-utils"; +import { MockedProvider } from "@apollo/react-testing"; import waitForFalseyProp from "/imports/test-utils/helpers/waitForFalseyProp"; import getTagId from "../queries/getTagId"; import withTagId from "./withTagId"; @@ -65,11 +66,14 @@ test("doesn't query GraphQL if no tagSlug is provided", async () => { }); test("passes shouldSkipGraphql to child component if invalid tagSlug is provided", async () => { - const wrapper = mount(( - - - - )); + let wrapper; + act(() => { + wrapper = mount(( + + + + )); + }); await waitForFalseyProp(wrapper, "MockComponent", "isLoadingTagId");