@@ -1717,6 +1717,128 @@ describe("maskOperation", () => {
1717
1717
} ) ;
1718
1718
} ) ;
1719
1719
1720
+ test ( 'handles overlapping types when subtype has accessor warnings with @unmask(mode: "migrate")' , async ( ) => {
1721
+ using consoleSpy = spyOnConsole ( "warn" ) ;
1722
+ const query = gql `
1723
+ query PlaylistQuery {
1724
+ playlist {
1725
+ ...PlaylistFragment @unmask(mode: "migrate")
1726
+ id
1727
+ name
1728
+ album {
1729
+ id
1730
+ tracks {
1731
+ id
1732
+ __typename
1733
+ }
1734
+ __typename
1735
+ }
1736
+ artist {
1737
+ id
1738
+ topTracks {
1739
+ id
1740
+ __typename
1741
+ }
1742
+ __typename
1743
+ }
1744
+ __typename
1745
+
1746
+ ...PlaylistTitleCell @unmask(mode: "migrate")
1747
+ }
1748
+ }
1749
+
1750
+ fragment PlaylistFragment on Playlist {
1751
+ album {
1752
+ id
1753
+ images {
1754
+ url
1755
+ __typename
1756
+ }
1757
+ tracks {
1758
+ id
1759
+ name
1760
+ __typename
1761
+ }
1762
+ __typename
1763
+ }
1764
+ }
1765
+
1766
+ fragment PlaylistTitleCell on Playlist {
1767
+ artist {
1768
+ id
1769
+ images {
1770
+ url
1771
+ __typename
1772
+ }
1773
+ topTracks {
1774
+ id
1775
+ name
1776
+ __typename
1777
+ }
1778
+ __typename
1779
+ }
1780
+ }
1781
+ ` ;
1782
+
1783
+ const data = maskOperation (
1784
+ {
1785
+ playlist : {
1786
+ id : "1" ,
1787
+ name : "Playlist" ,
1788
+ album : {
1789
+ id : "2RSIoPew2TOy41ASHpzOx3" ,
1790
+ __typename : "Album" ,
1791
+ images : [ { url : "https://i.scdn.co/image/1" , __typename : "Image" } ] ,
1792
+ tracks : [ { id : "1" , name : "Track 1" , __typename : "Track" } ] ,
1793
+ } ,
1794
+ artist : {
1795
+ id : "2" ,
1796
+ __typename : "Artist" ,
1797
+ images : [ { url : "https://i.scdn.co/image/1" , __typename : "Image" } ] ,
1798
+ topTracks : [ { id : "2" , name : "Track 2" , __typename : "Track" } ] ,
1799
+ } ,
1800
+ } ,
1801
+ } ,
1802
+ query ,
1803
+ new InMemoryCache ( )
1804
+ ) ;
1805
+
1806
+ expect ( consoleSpy . warn ) . not . toHaveBeenCalled ( ) ;
1807
+
1808
+ consoleSpy . warn . mockClear ( ) ;
1809
+
1810
+ data . playlist . album ;
1811
+ data . playlist . album . id ;
1812
+ data . playlist . album . __typename ;
1813
+ data . playlist . artist ;
1814
+ data . playlist . artist . id ;
1815
+ data . playlist . artist . __typename ;
1816
+ expect ( console . warn ) . not . toHaveBeenCalled ( ) ;
1817
+
1818
+ data . playlist . album . images ;
1819
+ data . playlist . artist . images ;
1820
+ expect ( console . warn ) . toHaveBeenCalledTimes ( 2 ) ;
1821
+
1822
+ expect ( data ) . toEqual ( {
1823
+ playlist : {
1824
+ id : "1" ,
1825
+ name : "Playlist" ,
1826
+ album : {
1827
+ id : "2RSIoPew2TOy41ASHpzOx3" ,
1828
+ __typename : "Album" ,
1829
+ images : [ { url : "https://i.scdn.co/image/1" , __typename : "Image" } ] ,
1830
+ tracks : [ { id : "1" , name : "Track 1" , __typename : "Track" } ] ,
1831
+ } ,
1832
+ artist : {
1833
+ id : "2" ,
1834
+ __typename : "Artist" ,
1835
+ images : [ { url : "https://i.scdn.co/image/1" , __typename : "Image" } ] ,
1836
+ topTracks : [ { id : "2" , name : "Track 2" , __typename : "Track" } ] ,
1837
+ } ,
1838
+ } ,
1839
+ } ) ;
1840
+ } ) ;
1841
+
1720
1842
test ( "masks fragments in subscription documents" , ( ) => {
1721
1843
const subscription = gql `
1722
1844
subscription {
0 commit comments