@@ -2,7 +2,7 @@ import { readFile } from 'node:fs/promises';
22import { join } from 'node:path' ;
33import { EnumStatusCode } from '@wundergraph/cosmo-connect/dist/common/common_pb' ;
44import { afterAll , afterEach , beforeAll , beforeEach , describe , expect , test , vi } from 'vitest' ;
5- import { parse } from 'graphql' ;
5+ import { Kind , parse } from 'graphql' ;
66import { joinLabel } from '@wundergraph/cosmo-shared' ;
77import {
88 FederationFailure ,
@@ -19,8 +19,10 @@ import {
1919 noBaseDefinitionForExtensionError ,
2020 noQueryRootTypeError ,
2121 OBJECT ,
22+ ObjectDefinitionData ,
2223 STRING_SCALAR ,
2324} from '@wundergraph/composition' ;
25+ import { SubgraphName } from '@wundergraph/composition/dist/types/types.js' ;
2426import { composeSubgraphs } from '../src/core/composition/composition.js' ;
2527import { afterAllSetup , beforeAllSetup , genID , genUniqueLabel } from '../src/core/test-util.js' ;
2628import { ClickHouseClient } from '../src/core/clickhouse/index.js' ;
@@ -344,7 +346,17 @@ describe('Composition error tests', (ctx) => {
344346 const result = composeSubgraphs ( [ subgraph1 , subgraph2 ] , LATEST_ROUTER_COMPATIBILITY_VERSION ) as FederationFailure ;
345347 expect ( result . success ) . toBe ( false ) ;
346348 expect ( result . errors ) . toHaveLength ( 1 ) ;
347- expect ( result . errors [ 0 ] ) . toStrictEqual ( incompatibleParentTypeMergeError ( 'SameName' , OBJECT , INTERFACE ) ) ;
349+ expect ( result . errors ) . toStrictEqual ( [
350+ incompatibleParentTypeMergeError ( {
351+ existingData : {
352+ name : 'SameName' ,
353+ kind : Kind . OBJECT_TYPE_DEFINITION ,
354+ subgraphNames : new Set < SubgraphName > ( [ subgraph1 . name ] ) ,
355+ } as ObjectDefinitionData ,
356+ incomingNodeType : INTERFACE ,
357+ incomingSubgraphName : subgraph2 . name ,
358+ } ) ,
359+ ] ) ;
348360 } ) ;
349361
350362 test ( 'that composition errors are returned if a type does not satisfy its implemented Interfaces after federation' , ( ) => {
0 commit comments