@@ -4655,6 +4655,39 @@ describe('composition', () => {
4655
4655
const authenticatedDirectiveExists = schema . directives ( ) . find ( d => d . name === 'authenticated' ) ;
4656
4656
expect ( authenticatedDirectiveExists ) . toBeUndefined ( ) ;
4657
4657
} ) ;
4658
+
4659
+ describe ( 'uses minimum required spec versions' , ( ) => {
4660
+ function subgraphWithFederationSpecVersion ( version : string ) {
4661
+ const schemaString = `
4662
+ extend schema @link(url: "https://specs.apollo.dev/federation/v${ version } ", import: ["@key"])
4663
+
4664
+ type Query {
4665
+ a: A
4666
+ }
4667
+
4668
+ type A @key(fields: "id") {
4669
+ id: ID!
4670
+ }
4671
+ ` ;
4672
+ return {
4673
+ typeDefs : gql `${ schemaString } ` ,
4674
+ name : 'subgraphA' ,
4675
+ } ;
4676
+ }
4677
+
4678
+ it . each ( [
4679
+ { subgraphFedVersion : "2.4" , expectedJoinVersion : "0.3" } ,
4680
+ { subgraphFedVersion : "2.5" , expectedJoinVersion : "0.3" } ,
4681
+ { subgraphFedVersion : "2.6" , expectedJoinVersion : "0.3" } ,
4682
+ { subgraphFedVersion : "2.7" , expectedJoinVersion : "0.4" } ,
4683
+ { subgraphFedVersion : "2.8" , expectedJoinVersion : "0.5" } ,
4684
+ ] ) ( "federation -> join versions" , ( { subgraphFedVersion, expectedJoinVersion } ) => {
4685
+ const subgraph = subgraphWithFederationSpecVersion ( subgraphFedVersion ) ;
4686
+ const result = composeServices ( [ subgraph ] ) ;
4687
+ assertCompositionSuccess ( result ) ;
4688
+ expect ( result . supergraphSdl ) . toContain ( `join/v${ expectedJoinVersion } ` ) ;
4689
+ } ) ;
4690
+ } ) ;
4658
4691
} ) ;
4659
4692
4660
4693
describe ( '@source* directives' , ( ) => {
0 commit comments