@@ -383,7 +383,7 @@ describe('near-operation-file preset', () => {
383383 } ) ;
384384
385385 it ( '#6439 - generating code only for the last query inside a file' , async ( ) => {
386- const result = await executeCodegen ( {
386+ const { result } = await executeCodegen ( {
387387 schema : [
388388 /* GraphQL */ `
389389 type Query {
@@ -427,7 +427,7 @@ describe('near-operation-file preset', () => {
427427 } ) ;
428428
429429 it ( '#6520 - self-importing fragment' , async ( ) => {
430- const result = await executeCodegen ( {
430+ const { result } = await executeCodegen ( {
431431 schema : [
432432 /* GraphQL */ `
433433 type Query {
@@ -457,7 +457,7 @@ describe('near-operation-file preset', () => {
457457 } ) ;
458458
459459 it ( '#6546 - duplicate fragment imports' , async ( ) => {
460- const result = await executeCodegen ( {
460+ const { result } = await executeCodegen ( {
461461 schema : [
462462 /* GraphQL */ `
463463 type Query {
@@ -556,7 +556,7 @@ describe('near-operation-file preset', () => {
556556 } ) ;
557557
558558 it ( '#7798 - importing type definitions of dependent fragments when `inlineFragmentType` is `mask`' , async ( ) => {
559- const result = await executeCodegen ( {
559+ const { result } = await executeCodegen ( {
560560 schema : [
561561 /* GraphQL */ `
562562 type User {
@@ -593,7 +593,7 @@ describe('near-operation-file preset', () => {
593593 } ) ;
594594
595595 it ( '#406 - duplicate fragment imports' , async ( ) => {
596- const result = await executeCodegen ( {
596+ const { result } = await executeCodegen ( {
597597 schema : [
598598 /* GraphQL */ `
599599 type Query {
@@ -1192,7 +1192,7 @@ describe('near-operation-file preset', () => {
11921192 } ) ;
11931193
11941194 it ( 'Should allow external fragments to be imported from packages with function' , async ( ) => {
1195- const spy = jest . fn ( ) ;
1195+ const spy = vi . fn ( ) ;
11961196 await executePreset ( {
11971197 baseOutputDir : './src/' ,
11981198 config : { } ,
@@ -1478,7 +1478,7 @@ describe('near-operation-file preset', () => {
14781478 } ) ;
14791479
14801480 it ( '#1112 - should import only interface types that are in use' , async ( ) => {
1481- const result = await executeCodegen ( {
1481+ const { result } = await executeCodegen ( {
14821482 schema : [
14831483 /* GraphQL */ `
14841484 type Query {
@@ -1526,23 +1526,37 @@ describe('near-operation-file preset', () => {
15261526 generatedDoc . filename . match ( / i s s u e - 1 1 1 2 - o p e r a t i o n / ) ,
15271527 ) . content ;
15281528
1529- expect ( interfaceContent ) . toContain (
1530- "export type AnimalFragment_Cat = { __typename?: 'Cat', name: string };" ,
1531- ) ;
1532- expect ( interfaceContent ) . toContain (
1533- "export type AnimalFragment_Dog = { __typename?: 'Dog', name: string };" ,
1534- ) ;
1535- expect ( interfaceContent ) . toContain (
1536- 'export type AnimalFragment = AnimalFragment_Cat | AnimalFragment_Dog;' ,
1537- ) ;
1529+ expect ( interfaceContent ) . toMatchInlineSnapshot ( `
1530+ "import * as Types from '../../../../../out1.ts/types';
15381531
1539- expect ( operationContent ) . toContain (
1540- "import { AnimalFragment_Cat } from './issue-1112-interface.generated'" ,
1541- ) ;
1532+ export type AnimalFragment_Cat = { __typename?: 'Cat', name: string };
1533+
1534+ export type AnimalFragment_Dog = { __typename?: 'Dog', name: string };
1535+
1536+ export type AnimalFragment =
1537+ | AnimalFragment_Cat
1538+ | AnimalFragment_Dog
1539+ ;
1540+ "
1541+ ` ) ;
1542+
1543+ expect ( operationContent ) . toMatchInlineSnapshot ( `
1544+ "import * as Types from '../../../../../out1.ts/types';
1545+
1546+ import { AnimalFragment_Cat } from './issue-1112-interface.generated';
1547+ export type CatsQueryVariables = Types.Exact<{ [key: string]: never; }>;
1548+
1549+
1550+ export type CatsQuery = { __typename?: 'Query', cats: Array<(
1551+ { __typename?: 'Cat' }
1552+ & AnimalFragment_Cat
1553+ )> };
1554+ "
1555+ ` ) ;
15421556 } ) ;
15431557
15441558 it ( 'generates correctly without baseTypesPath for standalone typescript-operations' , async ( ) => {
1545- const result = await executeCodegen ( {
1559+ const { result } = await executeCodegen ( {
15461560 schema : /* GraphQL */ `
15471561 type Query {
15481562 user: User
0 commit comments