diff --git a/packages/plugins/typescript/resolvers/tests/ts-resolvers.federation.mappers.spec.ts b/packages/plugins/typescript/resolvers/tests/ts-resolvers.federation.mappers.spec.ts index 928f659410e..9db647c00cc 100644 --- a/packages/plugins/typescript/resolvers/tests/ts-resolvers.federation.mappers.spec.ts +++ b/packages/plugins/typescript/resolvers/tests/ts-resolvers.federation.mappers.spec.ts @@ -1,19 +1,5 @@ import '@graphql-codegen/testing'; -import { codegen } from '@graphql-codegen/core'; -import { parse } from 'graphql'; -import { TypeScriptResolversPluginConfig } from '../src/config.js'; -import { plugin } from '../src/index.js'; - -function generate({ schema, config }: { schema: string; config: TypeScriptResolversPluginConfig }) { - return codegen({ - filename: 'graphql.ts', - schema: parse(schema), - documents: [], - plugins: [{ 'typescript-resolvers': {} }], - config, - pluginMap: { 'typescript-resolvers': { plugin } }, - }); -} +import { generate } from './utils'; describe('TypeScript Resolvers Plugin + Apollo Federation - mappers', () => { it('generates FederationTypes and use it for reference type', async () => { diff --git a/packages/plugins/typescript/resolvers/tests/utils.ts b/packages/plugins/typescript/resolvers/tests/utils.ts new file mode 100644 index 00000000000..20f77f1ac05 --- /dev/null +++ b/packages/plugins/typescript/resolvers/tests/utils.ts @@ -0,0 +1,15 @@ +import { codegen } from '@graphql-codegen/core'; +import { parse } from 'graphql'; +import { TypeScriptResolversPluginConfig } from '../src/config.js'; +import { plugin } from '../src/index.js'; + +export function generate({ schema, config }: { schema: string; config: TypeScriptResolversPluginConfig }) { + return codegen({ + filename: 'graphql.ts', + schema: parse(schema), + documents: [], + plugins: [{ 'typescript-resolvers': {} }], + config, + pluginMap: { 'typescript-resolvers': { plugin } }, + }); +}