@@ -1347,143 +1347,6 @@ describe('FroidSchema class', () => {
13471347 ) ;
13481348 } ) ;
13491349
1350- it ( 'applies the @shareable directive to types marked with @shareable and includes all fields from supergraph' , ( ) => {
1351- const bookSchema = gql `
1352- type Book @key(fields: "isbn") {
1353- isbn: String!
1354- title: String!
1355- author: Author!
1356- }
1357-
1358- type Author @shareable {
1359- authorId: Int!
1360- }
1361- ` ;
1362-
1363- const authorSchema = gql `
1364- type Author @shareable {
1365- authorId: Int!
1366- name: String!
1367- email: String!
1368- age: Int
1369- }
1370- ` ;
1371-
1372- const subgraphs = new Map ( ) ;
1373- subgraphs . set ( 'book-subgraph' , bookSchema ) ;
1374- subgraphs . set ( 'author-subgraph' , authorSchema ) ;
1375-
1376- const actual = generateSchema ( {
1377- subgraphs,
1378- froidSubgraphName : 'relay-subgraph' ,
1379- contractTags : [ 'storefront' , 'internal' ] ,
1380- federationVersion : FED2_DEFAULT_VERSION ,
1381- } ) ;
1382-
1383- expect ( actual ) . toEqual (
1384- // prettier-ignore
1385- gql `
1386- extend schema @link(url: "https://specs.apollo.dev/federation/v2.0", import: ["@key", "@tag", "@external", "@shareable"])
1387-
1388- type Author @shareable {
1389- age: Int
1390- authorId: Int!
1391- email: String!
1392- name: String!
1393- }
1394-
1395- type Book implements Node @key(fields: "isbn") {
1396- "The globally unique identifier."
1397- id: ID!
1398- isbn: String!
1399- }
1400-
1401- "The global identification interface implemented by all entities."
1402- interface Node @tag(name: "internal") @tag(name: "storefront") {
1403- "The globally unique identifier."
1404- id: ID!
1405- }
1406-
1407- type Query {
1408- "Fetches an entity by its globally unique identifier."
1409- node(
1410- "A globally unique entity identifier."
1411- id: ID!
1412- ): Node @tag(name: "internal") @tag(name: "storefront")
1413- }
1414- `
1415- ) ;
1416- } ) ;
1417-
1418- it ( 'applies the @external directive to fields marked with @shareable and includes them in froid schema' , ( ) => {
1419- const bookSchema = gql `
1420- type Book @key(fields: "isbn") {
1421- isbn: String!
1422- title: String!
1423- edition: Edition
1424- }
1425-
1426- type Edition @key(fields: "isbn") {
1427- isbn: String!
1428- publicationYear: Int @shareable
1429- }
1430- ` ;
1431-
1432- const editionsSchema = gql `
1433- type Edition @key(fields: "isbn") {
1434- isbn: String!
1435- format: String!
1436- pageCount: Int!
1437- publicationYear: Int @shareable
1438- }
1439- ` ;
1440-
1441- const subgraphs = new Map ( ) ;
1442- subgraphs . set ( 'book-subgraph' , bookSchema ) ;
1443- subgraphs . set ( 'editions-subgraph' , editionsSchema ) ;
1444-
1445- const actual = generateSchema ( {
1446- subgraphs,
1447- froidSubgraphName : 'relay-subgraph' ,
1448- contractTags : [ 'storefront' , 'internal' ] ,
1449- federationVersion : FED2_DEFAULT_VERSION ,
1450- } ) ;
1451-
1452- expect ( actual ) . toEqual (
1453- // prettier-ignore
1454- gql `
1455- extend schema @link(url: "https://specs.apollo.dev/federation/v2.0", import: ["@key", "@tag", "@external"])
1456-
1457- type Book implements Node @key(fields: "isbn") {
1458- "The globally unique identifier."
1459- id: ID!
1460- isbn: String!
1461- }
1462-
1463- type Edition implements Node @key(fields: "isbn") {
1464- "The globally unique identifier."
1465- id: ID!
1466- isbn: String!
1467- publicationYear: Int @external
1468- }
1469-
1470- "The global identification interface implemented by all entities."
1471- interface Node @tag(name: "internal") @tag(name: "storefront") {
1472- "The globally unique identifier."
1473- id: ID!
1474- }
1475-
1476- type Query {
1477- "Fetches an entity by its globally unique identifier."
1478- node(
1479- "A globally unique entity identifier."
1480- id: ID!
1481- ): Node @tag(name: "internal") @tag(name: "storefront")
1482- }
1483- `
1484- ) ;
1485- } ) ;
1486-
14871350 it ( 'uses a custom qualifier to prefer fields' , ( ) => {
14881351 const bookSchema = gql `
14891352 type Book @key(fields: "isbn") {
0 commit comments