|
1 | 1 | import { mergeOutputs, Types } from '@graphql-codegen/plugin-helpers'; |
2 | 2 | import { validateTs } from '@graphql-codegen/testing'; |
3 | 3 | import { buildSchema, parse } from 'graphql'; |
4 | | -import { plugin as tsPlugin } from '../../typescript/src/index.js'; |
5 | | -import { plugin, TypeScriptDocumentsPluginConfig } from '../src/index.js'; |
| 4 | +import { plugin, type TypeScriptDocumentsPluginConfig } from '../src/index.js'; |
6 | 5 |
|
7 | 6 | describe('extractAllFieldsToTypes: true', () => { |
8 | | - const validate = async (content: Types.PluginOutput, config: any = {}, pluginSchema) => { |
9 | | - const m = mergeOutputs([await tsPlugin(pluginSchema, [], config, { outputFile: '' }), content]); |
| 7 | + const validate = async (content: Types.PluginOutput) => { |
| 8 | + const m = mergeOutputs([content]); |
10 | 9 | validateTs(m, undefined, undefined, undefined, []); |
11 | 10 |
|
12 | 11 | return m; |
@@ -197,7 +196,7 @@ describe('extractAllFieldsToTypes: true', () => { |
197 | 196 | " |
198 | 197 | `); |
199 | 198 |
|
200 | | - await validate(content, config, dummyUserTestSchema); |
| 199 | + await validate(content); |
201 | 200 | }); |
202 | 201 |
|
203 | 202 | const complexTestSchemaWithUnionsAndInterfaces = buildSchema(/* GraphQL */ ` |
@@ -551,7 +550,7 @@ describe('extractAllFieldsToTypes: true', () => { |
551 | 550 | " |
552 | 551 | `); |
553 | 552 |
|
554 | | - await validate(content, config, complexTestSchemaWithUnionsAndInterfaces); |
| 553 | + await validate(content); |
555 | 554 | }); |
556 | 555 |
|
557 | 556 | it('should extract types from multiple fragments (mergeFragmentTypes: true)', async () => { |
@@ -725,7 +724,7 @@ describe('extractAllFieldsToTypes: true', () => { |
725 | 724 | " |
726 | 725 | `); |
727 | 726 |
|
728 | | - await validate(content, config, complexTestSchemaWithUnionsAndInterfaces); |
| 727 | + await validate(content); |
729 | 728 | }); |
730 | 729 |
|
731 | 730 | it("should extract types from multiple fragments (inlineFragmentTypes: 'combine')", async () => { |
@@ -968,7 +967,7 @@ describe('extractAllFieldsToTypes: true', () => { |
968 | 967 | " |
969 | 968 | `); |
970 | 969 |
|
971 | | - await validate(content, config, complexTestSchemaWithUnionsAndInterfaces); |
| 970 | + await validate(content); |
972 | 971 | }); |
973 | 972 |
|
974 | 973 | it("should extract types from multiple fragments (inlineFragmentTypes: 'mask')", async () => { |
@@ -1209,7 +1208,7 @@ describe('extractAllFieldsToTypes: true', () => { |
1209 | 1208 | " |
1210 | 1209 | `); |
1211 | 1210 |
|
1212 | | - await validate(content, config, complexTestSchemaWithUnionsAndInterfaces); |
| 1211 | + await validate(content); |
1213 | 1212 | }); |
1214 | 1213 |
|
1215 | 1214 | it('fields with shared types and no fragments should use the shared type interface name', async () => { |
@@ -1302,7 +1301,7 @@ describe('extractAllFieldsToTypes: true', () => { |
1302 | 1301 | " |
1303 | 1302 | `); |
1304 | 1303 |
|
1305 | | - await validate(content, config, nestedInterfacesSchema); |
| 1304 | + await validate(content); |
1306 | 1305 | }); |
1307 | 1306 |
|
1308 | 1307 | it('fragment spreads on the same interface should not force concrete parent type names (regression #10502)', async () => { |
@@ -1518,7 +1517,7 @@ describe('extractAllFieldsToTypes: true', () => { |
1518 | 1517 | export type GetNotificationsQuery = GetNotificationsQuery_Query; |
1519 | 1518 | " |
1520 | 1519 | `); |
1521 | | - await validate(content, config, notificationSchema); |
| 1520 | + await validate(content); |
1522 | 1521 | }); |
1523 | 1522 |
|
1524 | 1523 | it('named fragments should use their name and not parent type name', async () => { |
@@ -1599,6 +1598,6 @@ describe('extractAllFieldsToTypes: true', () => { |
1599 | 1598 | export type GetNotificationsQuery = GetNotificationsQuery_Query; |
1600 | 1599 | " |
1601 | 1600 | `); |
1602 | | - await validate(content, config, notificationSchema); |
| 1601 | + await validate(content); |
1603 | 1602 | }); |
1604 | 1603 | }); |
0 commit comments