From 10ef7338cdcbbaf75d806f426e9708c9e095c2da Mon Sep 17 00:00:00 2001 From: Jerel Miller Date: Mon, 13 Jan 2025 13:17:33 -0700 Subject: [PATCH] Remove `itAsync` test function from `@apollo/client/testing` (#12262) --- .api-reports/api-report-testing.api.md | 7 ----- .api-reports/api-report-testing_core.api.md | 7 ----- .changeset/itchy-drinks-refuse.md | 5 ++++ src/__tests__/__snapshots__/exports.ts.snap | 2 -- src/testing/core/index.ts | 1 - src/testing/core/itAsync.ts | 32 --------------------- 6 files changed, 5 insertions(+), 49 deletions(-) create mode 100644 .changeset/itchy-drinks-refuse.md delete mode 100644 src/testing/core/itAsync.ts diff --git a/.api-reports/api-report-testing.api.md b/.api-reports/api-report-testing.api.md index d96ca073927..91b9957c7ec 100644 --- a/.api-reports/api-report-testing.api.md +++ b/.api-reports/api-report-testing.api.md @@ -908,13 +908,6 @@ function isReference(obj: any): obj is Reference; // @public (undocumented) type IsStrictlyAny = UnionToIntersection> extends never ? true : false; -// @public (undocumented) -export const itAsync: ((this: unknown, message: string, callback: (resolve: (result?: any) => void, reject: (reason?: any) => void) => any, timeout?: number | undefined) => void) & { - only: (message: string, callback: (resolve: (result?: any) => void, reject: (reason?: any) => void) => any, timeout?: number) => void; - skip: (message: string, callback: (resolve: (result?: any) => void, reject: (reason?: any) => void) => any, timeout?: number) => void; - todo: (message: string, callback: (resolve: (result?: any) => void, reject: (reason?: any) => void) => any, timeout?: number) => void; -}; - // @public (undocumented) class LocalState { // Warning: (ae-forgotten-export) The symbol "LocalStateOptions" needs to be exported by the entry point index.d.ts diff --git a/.api-reports/api-report-testing_core.api.md b/.api-reports/api-report-testing_core.api.md index c5bbb1d5da9..54a46719af2 100644 --- a/.api-reports/api-report-testing_core.api.md +++ b/.api-reports/api-report-testing_core.api.md @@ -907,13 +907,6 @@ function isReference(obj: any): obj is Reference; // @public (undocumented) type IsStrictlyAny = UnionToIntersection> extends never ? true : false; -// @public (undocumented) -export const itAsync: ((this: unknown, message: string, callback: (resolve: (result?: any) => void, reject: (reason?: any) => void) => any, timeout?: number | undefined) => void) & { - only: (message: string, callback: (resolve: (result?: any) => void, reject: (reason?: any) => void) => any, timeout?: number) => void; - skip: (message: string, callback: (resolve: (result?: any) => void, reject: (reason?: any) => void) => any, timeout?: number) => void; - todo: (message: string, callback: (resolve: (result?: any) => void, reject: (reason?: any) => void) => any, timeout?: number) => void; -}; - // @public (undocumented) class LocalState { // Warning: (ae-forgotten-export) The symbol "LocalStateOptions" needs to be exported by the entry point index.d.ts diff --git a/.changeset/itchy-drinks-refuse.md b/.changeset/itchy-drinks-refuse.md new file mode 100644 index 00000000000..9b7111816d2 --- /dev/null +++ b/.changeset/itchy-drinks-refuse.md @@ -0,0 +1,5 @@ +--- +"@apollo/client": major +--- + +Remove `itAsync` test utility. diff --git a/src/__tests__/__snapshots__/exports.ts.snap b/src/__tests__/__snapshots__/exports.ts.snap index 1019413b6bd..7e8ee9063b8 100644 --- a/src/__tests__/__snapshots__/exports.ts.snap +++ b/src/__tests__/__snapshots__/exports.ts.snap @@ -360,7 +360,6 @@ Array [ "MockSubscriptionLink", "MockedProvider", "createMockClient", - "itAsync", "mockObservableLink", "mockSingleLink", "tick", @@ -376,7 +375,6 @@ Array [ "MockLink", "MockSubscriptionLink", "createMockClient", - "itAsync", "mockObservableLink", "mockSingleLink", "tick", diff --git a/src/testing/core/index.ts b/src/testing/core/index.ts index 94af1dbe3ea..65bec6a5bc5 100644 --- a/src/testing/core/index.ts +++ b/src/testing/core/index.ts @@ -9,6 +9,5 @@ export { mockObservableLink, } from "./mocking/mockSubscriptionLink.js"; export { createMockClient } from "./mocking/mockClient.js"; -export { itAsync } from "./itAsync.js"; export { wait, tick } from "./wait.js"; export * from "./withConsoleSpy.js"; diff --git a/src/testing/core/itAsync.ts b/src/testing/core/itAsync.ts deleted file mode 100644 index fc664cbac07..00000000000 --- a/src/testing/core/itAsync.ts +++ /dev/null @@ -1,32 +0,0 @@ -function wrap(key?: "only" | "skip" | "todo") { - return ( - message: string, - callback: ( - resolve: (result?: any) => void, - reject: (reason?: any) => void - ) => any, - timeout?: number - ) => - (key ? it[key] : it)( - message, - function (this: unknown) { - return new Promise((resolve, reject) => - callback.call(this, resolve, reject) - ); - }, - timeout - ); -} - -const wrappedIt = wrap(); - -export const itAsync = Object.assign( - function (this: unknown, ...args: Parameters) { - return wrappedIt.apply(this, args); - }, - { - only: wrap("only"), - skip: wrap("skip"), - todo: wrap("todo"), - } -);