diff --git a/src/__tests__/__snapshots__/exports.ts.snap b/src/__tests__/__snapshots__/exports.ts.snap index a2e89a93514..be43348733a 100644 --- a/src/__tests__/__snapshots__/exports.ts.snap +++ b/src/__tests__/__snapshots__/exports.ts.snap @@ -369,9 +369,11 @@ Array [ "MockSubscriptionLink", "MockedProvider", "createMockClient", + "createMockSchema", "itAsync", "mockObservableLink", "mockSingleLink", + "proxiedSchema", "subscribeAndCount", "tick", "wait", @@ -389,6 +391,7 @@ Array [ "itAsync", "mockObservableLink", "mockSingleLink", + "proxiedSchema", "subscribeAndCount", "tick", "wait", diff --git a/src/testing/core/index.ts b/src/testing/core/index.ts index e999590509a..73072db65cb 100644 --- a/src/testing/core/index.ts +++ b/src/testing/core/index.ts @@ -12,4 +12,5 @@ export { createMockClient } from "./mocking/mockClient.js"; export { default as subscribeAndCount } from "./subscribeAndCount.js"; export { itAsync } from "./itAsync.js"; export { wait, tick } from "./wait.js"; +export { proxiedSchema } from "./schemaProxy.js"; export * from "./withConsoleSpy.js"; diff --git a/src/testing/core/schemaProxy.ts b/src/testing/core/schemaProxy.ts index 9f7147d7cdc..56564a7e5e7 100644 --- a/src/testing/core/schemaProxy.ts +++ b/src/testing/core/schemaProxy.ts @@ -23,7 +23,9 @@ const proxiedSchema = ( }, })); } + // @ts-expect-error if (typeof targetSchema[p] === "function") { + // @ts-expect-error return targetSchema[p].bind(targetSchema); } return Reflect.get(target, p); diff --git a/src/testing/index.ts b/src/testing/index.ts index be84a5e57e5..2a499aa8d97 100644 --- a/src/testing/index.ts +++ b/src/testing/index.ts @@ -2,3 +2,4 @@ import "../utilities/globals/index.js"; export type { MockedProviderProps } from "./react/MockedProvider.js"; export { MockedProvider } from "./react/MockedProvider.js"; export * from "./core/index.js"; +export { createMockSchema } from "./graphql-tools/utils.js";