@@ -1749,6 +1749,39 @@ describe('Merge TypeDefs', () => {
1749
1749
expect ( reformulatedGraphQL ) . toBeSimilarString ( schemaWithDescription ) ;
1750
1750
} ) ;
1751
1751
1752
+ it ( 'merges the directives with the same name and same arguments (@link)' , ( ) => {
1753
+ const schema1 = parse ( /* GraphQL */ `
1754
+ extend schema
1755
+ @link(
1756
+ url: "https://specs.apollo.dev/federation/v2.3"
1757
+ import: ["@composeDirective", "@external", "@foo"]
1758
+ )
1759
+ ` ) ;
1760
+
1761
+ const schema2 = parse ( /* GraphQL */ `
1762
+ extend schema
1763
+ @link(
1764
+ url: "https://specs.apollo.dev/federation/v2.3"
1765
+ import: ["@composeDirective", "@external"]
1766
+ )
1767
+ @link(url: "file://foo.org/trackable/v2.3", import: ["@trackable"])
1768
+ ` ) ;
1769
+ const typeDefs = [ schema1 , schema2 ] ;
1770
+ const merged = mergeTypeDefs ( typeDefs ) ;
1771
+ const prettyOutput = print ( merged ) ;
1772
+ const prettyExpected = print (
1773
+ parse ( /* GraphQL */ `
1774
+ extend schema
1775
+ @link(
1776
+ url: "https://specs.apollo.dev/federation/v2.3"
1777
+ import: ["@composeDirective", "@external", "@foo"]
1778
+ )
1779
+ @link(url: "file://foo.org/trackable/v2.3", import: ["@trackable"]) # unique to schema 2
1780
+ ` ) ,
1781
+ ) ;
1782
+ expect ( prettyOutput ) . toBeSimilarString ( prettyExpected ) ;
1783
+ } ) ;
1784
+
1752
1785
it ( 'merges the directives with the same name and same arguments' , ( ) => {
1753
1786
const directive = parse ( /* GraphQL */ `
1754
1787
directive @link(
@@ -1762,7 +1795,6 @@ describe('Merge TypeDefs', () => {
1762
1795
const merged = mergeTypeDefs ( typeDefs ) ;
1763
1796
expect ( print ( merged ) ) . toBeSimilarString ( print ( directive ) ) ;
1764
1797
} ) ;
1765
-
1766
1798
it ( 'does not merge repeatable Federation directives without the same arguments' , ( ) => {
1767
1799
const ast = parse ( /* GraphQL */ `
1768
1800
extend schema
0 commit comments