({
posts,
highlightEnabled,
numCards = 4,
pageSize = 25,
adStart = 4,
adRepeat = 8,
minSpacing = 5,
startIndex = 0,
briefBannerPage,
staticAd,
disableAds,
user = defaultUser,
isHorizontal,
feedName = SharedFeedPage.MyFeed,
}: HighlightLayoutRenderParams)
| 1895 | } |
| 1896 | |
| 1897 | const renderWithHighlightLayout = ({ |
| 1898 | posts, |
| 1899 | highlightEnabled, |
| 1900 | numCards = 4, |
| 1901 | pageSize = 25, |
| 1902 | adStart = 4, |
| 1903 | adRepeat = 8, |
| 1904 | minSpacing = 5, |
| 1905 | startIndex = 0, |
| 1906 | briefBannerPage, |
| 1907 | staticAd, |
| 1908 | disableAds, |
| 1909 | user = defaultUser, |
| 1910 | isHorizontal, |
| 1911 | feedName = SharedFeedPage.MyFeed, |
| 1912 | }: HighlightLayoutRenderParams): RenderResult => { |
| 1913 | variables = { ...defaultVariables, first: pageSize, columns: numCards }; |
| 1914 | mockGraphQL(createFeedMock(buildFeedPage(posts))); |
| 1915 | // First ad page uses active=false, subsequent pages use active=true. Mock |
| 1916 | // both up to a handful of refills so multi-ad scenarios don't run dry. |
| 1917 | nock('http://localhost:3000') |
| 1918 | .get('/v1/a?active=false&gdpr=0') |
| 1919 | .reply(200, [ad]); |
| 1920 | nock('http://localhost:3000') |
| 1921 | .get('/v1/a?active=true&gdpr=0') |
| 1922 | .times(10) |
| 1923 | .reply(200, [ad]); |
| 1924 | |
| 1925 | const feedContextValue: FeedContextData = { |
| 1926 | pageSize, |
| 1927 | numCards: { |
| 1928 | eco: numCards, |
| 1929 | roomy: numCards, |
| 1930 | cozy: numCards, |
| 1931 | } as FeedContextData['numCards'], |
| 1932 | adTemplate: { adStart, adRepeat }, |
| 1933 | }; |
| 1934 | |
| 1935 | const gb = new GrowthBook(); |
| 1936 | gb.setFeatures({ |
| 1937 | [featureHeroCards.id]: { |
| 1938 | defaultValue: { |
| 1939 | enabled: highlightEnabled, |
| 1940 | minSpacing, |
| 1941 | startIndex, |
| 1942 | chipLabels: {}, |
| 1943 | allowedPostTypes: { |
| 1944 | [PostType.Article]: true, |
| 1945 | [PostType.VideoYouTube]: true, |
| 1946 | [PostType.Share]: true, |
| 1947 | [PostType.Freeform]: true, |
| 1948 | [PostType.Collection]: true, |
| 1949 | }, |
| 1950 | }, |
| 1951 | }, |
| 1952 | ...(briefBannerPage |
| 1953 | ? { |
| 1954 | [briefFeedEntrypointPage.id]: { |
no test coverage detected