diff --git a/package-lock.json b/package-lock.json index 990137a2fff..a1613eb435b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -40,7 +40,7 @@ "@testing-library/dom": "^10.4.0", "@testing-library/jest-dom": "6.4.6", "@testing-library/react": "^16.0.1", - "@testing-library/react-render-stream": "https://pkg.pr.new/testing-library/react-render-stream-testing-library/@testing-library/react-render-stream@fab8705f2", + "@testing-library/react-render-stream": "https://pkg.pr.new/testing-library/react-render-stream-testing-library/@testing-library/react-render-stream@04c222de7", "@testing-library/user-event": "14.5.2", "@tsconfig/node20": "20.1.4", "@types/bytes": "3.1.4", @@ -3535,8 +3535,8 @@ }, "node_modules/@testing-library/react-render-stream": { "version": "0.0.0-semantically-released", - "resolved": "https://pkg.pr.new/testing-library/react-render-stream-testing-library/@testing-library/react-render-stream@fab8705f2", - "integrity": "sha512-LubzeLH6F6/n16p5nvpGBbB2GZFxAloEIu6til0SZs6RfQKZ+6/J2D4DkcjT4tDZK+3p0YjZ/i+SgVBV+rpmmQ==", + "resolved": "https://pkg.pr.new/testing-library/react-render-stream-testing-library/@testing-library/react-render-stream@04c222de7", + "integrity": "sha512-V1jKqrAXPjdNeuHeVeU376HxEYgkMDCQvu/OWc0SkxhmQdjy7ihfHbFzFG+lzl/TMETPBl+qCDULwTle/cnMSw==", "dev": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index df36fda91fc..5dc5e0b6cfe 100644 --- a/package.json +++ b/package.json @@ -122,7 +122,7 @@ "@testing-library/dom": "^10.4.0", "@testing-library/jest-dom": "6.4.6", "@testing-library/react": "^16.0.1", - "@testing-library/react-render-stream": "https://pkg.pr.new/testing-library/react-render-stream-testing-library/@testing-library/react-render-stream@fab8705f2", + "@testing-library/react-render-stream": "https://pkg.pr.new/testing-library/react-render-stream-testing-library/@testing-library/react-render-stream@04c222de7", "@testing-library/user-event": "14.5.2", "@tsconfig/node20": "20.1.4", "@types/bytes": "3.1.4", diff --git a/src/react/components/__tests__/client/Query.test.tsx b/src/react/components/__tests__/client/Query.test.tsx index 0087a406ec0..a97807838aa 100644 --- a/src/react/components/__tests__/client/Query.test.tsx +++ b/src/react/components/__tests__/client/Query.test.tsx @@ -13,7 +13,7 @@ import { Query } from "../../Query"; import { QueryResult } from "../../../types/types"; import { disableActEnvironment, - renderToRenderStream, + createRenderStream, } from "@testing-library/react-render-stream"; const allPeopleQuery: DocumentNode = gql` @@ -1504,7 +1504,9 @@ describe("Query component", () => { } using _disabledAct = disableActEnvironment(); - const { takeRender, replaceSnapshot } = renderToRenderStream( + const { takeRender, replaceSnapshot, render } = + createRenderStream(); + await render( diff --git a/src/react/components/__tests__/client/Subscription.test.tsx b/src/react/components/__tests__/client/Subscription.test.tsx index 945ccb4b13c..efe15db56c0 100644 --- a/src/react/components/__tests__/client/Subscription.test.tsx +++ b/src/react/components/__tests__/client/Subscription.test.tsx @@ -11,7 +11,7 @@ import { Subscription } from "../../Subscription"; import { spyOnConsole } from "../../../../testing/internal"; import { disableActEnvironment, - renderToRenderStream, + createRenderStream, } from "@testing-library/react-render-stream"; const results = [ @@ -439,13 +439,12 @@ describe("should update", () => { ); } using _disabledAct = disableActEnvironment(); - const { takeRender, replaceSnapshot, renderResultPromise } = - renderToRenderStream( - - - - ); - const { rerender } = await renderResultPromise; + const { takeRender, replaceSnapshot, render } = createRenderStream(); + const { rerender } = await render( + + + + ); { const { snapshot: { loading, data }, @@ -537,13 +536,15 @@ describe("should update", () => { } using _disabledAct = disableActEnvironment(); - const { takeRender, replaceSnapshot, renderResultPromise } = - renderToRenderStream(, { + const { takeRender, replaceSnapshot, render } = createRenderStream(); + const { rerender } = await render( + , + { wrapper: ({ children }) => ( {children} ), - }); - const { rerender } = await renderResultPromise; + } + ); { const { @@ -631,13 +632,12 @@ describe("should update", () => { ); } using _disabledAct = disableActEnvironment(); - const { takeRender, renderResultPromise, replaceSnapshot } = - renderToRenderStream(, { - wrapper: ({ children }) => ( - {children} - ), - }); - const { rerender } = await renderResultPromise; + const { takeRender, render, replaceSnapshot } = createRenderStream(); + const { rerender } = await render(, { + wrapper: ({ children }) => ( + {children} + ), + }); { const { diff --git a/src/react/hoc/__tests__/queries/lifecycle.test.tsx b/src/react/hoc/__tests__/queries/lifecycle.test.tsx index 5a4811ec02c..674bf048156 100644 --- a/src/react/hoc/__tests__/queries/lifecycle.test.tsx +++ b/src/react/hoc/__tests__/queries/lifecycle.test.tsx @@ -12,7 +12,7 @@ import { graphql } from "../../graphql"; import { ChildProps, DataValue } from "../../types"; import { disableActEnvironment, - renderToRenderStream, + createRenderStream, } from "@testing-library/react-render-stream"; describe("[queries] lifecycle", () => { @@ -62,13 +62,13 @@ describe("[queries] lifecycle", () => { ); using _disabledAct = disableActEnvironment(); - const { takeRender, replaceSnapshot, renderResultPromise } = - renderToRenderStream>(, { - wrapper: ({ children }) => ( - {children} - ), - }); - const { rerender } = await renderResultPromise; + const { takeRender, replaceSnapshot, render } = + createRenderStream>(); + const { rerender } = await render(, { + wrapper: ({ children }) => ( + {children} + ), + }); { const { snapshot } = await takeRender(); diff --git a/src/react/hooks/__tests__/useFragment.test.tsx b/src/react/hooks/__tests__/useFragment.test.tsx index 57812e45e72..c31e8e2b6e4 100644 --- a/src/react/hooks/__tests__/useFragment.test.tsx +++ b/src/react/hooks/__tests__/useFragment.test.tsx @@ -33,7 +33,7 @@ import { SubscriptionObserver } from "zen-observable-ts"; import { disableActEnvironment, renderHookToSnapshotStream, - renderToRenderStream, + createRenderStream, } from "@testing-library/react-render-stream"; import { spyOnConsole } from "../../../testing/internal"; @@ -1807,18 +1807,17 @@ describe("has the same timing as `useQuery`", () => { } using _disabledAct = disableActEnvironment(); - const { takeRender, replaceSnapshot } = renderToRenderStream( - , - { - initialSnapshot: { - queryData: undefined as any, - fragmentData: undefined as any, - }, - wrapper: ({ children }) => ( - {children} - ), - } - ); + const { takeRender, replaceSnapshot, render } = createRenderStream({ + initialSnapshot: { + queryData: undefined as any, + fragmentData: undefined as any, + }, + }); + await render(, { + wrapper: ({ children }) => ( + {children} + ), + }); { const { snapshot } = await takeRender(); @@ -1889,7 +1888,7 @@ describe("has the same timing as `useQuery`", () => { } using _disabledAct = disableActEnvironment(); - const { takeRender } = renderToRenderStream(, { + const { takeRender, render } = createRenderStream({ snapshotDOM: true, onRender() { const parent = screen.getByTestId("parent"); @@ -1901,6 +1900,8 @@ describe("has the same timing as `useQuery`", () => { within(children).queryAllByText(/Item #2/).length ); }, + }); + await render(, { wrapper: ({ children }) => ( {children} ), @@ -1981,7 +1982,7 @@ describe("has the same timing as `useQuery`", () => { } using _disabledAct = disableActEnvironment(); - const { takeRender } = renderToRenderStream(, { + const { takeRender, render } = createRenderStream({ onRender() { const parent = screen.getByTestId("parent"); const children = screen.getByTestId("children"); @@ -1992,6 +1993,8 @@ describe("has the same timing as `useQuery`", () => { within(children).queryAllByText(/Item #2/).length ); }, + }); + await render(, { wrapper: ({ children }) => ( {children} ), diff --git a/src/react/hooks/__tests__/useSuspenseQuery.test.tsx b/src/react/hooks/__tests__/useSuspenseQuery.test.tsx index 163b4cd5766..cb26d825d44 100644 --- a/src/react/hooks/__tests__/useSuspenseQuery.test.tsx +++ b/src/react/hooks/__tests__/useSuspenseQuery.test.tsx @@ -64,7 +64,6 @@ import { import { createRenderStream, disableActEnvironment, - renderToRenderStream, useTrackRenders, } from "@testing-library/react-render-stream"; @@ -401,10 +400,12 @@ describe("useSuspenseQuery", () => { }); using _disabledAct = disableActEnvironment(); - const { takeRender, replaceSnapshot } = await renderToRenderStream< + const { takeRender, replaceSnapshot, render } = await createRenderStream< UseSuspenseQueryResult - >(, { + >({ snapshotDOM: true, + }); + await render(, { wrapper: ({ children }) => ( {children} ), @@ -9792,9 +9793,10 @@ describe("useSuspenseQuery", () => { } using _disabledAct = disableActEnvironment(); - const { takeRender } = await renderToRenderStream(, { + const { takeRender, render } = await createRenderStream({ snapshotDOM: true, }); + await render(); { const { withinDOM } = await takeRender();