({
posts,
highlightEnabled,
numCards = 4,
pageSize = 25,
adStart = 4,
adRepeat = 8,
minSpacing = 5,
startIndex = 0,
briefBannerPage,
plusFeedBanner,
forceAd,
staticAd,
disableAds,
skipFirstAd,
user = defaultUser,
isHorizontal,
feedName = SharedFeedPage.MyFeed,
}: HighlightLayoutRenderParams)
| 2761 | } |
| 2762 | |
| 2763 | const renderWithHighlightLayout = ({ |
| 2764 | posts, |
| 2765 | highlightEnabled, |
| 2766 | numCards = 4, |
| 2767 | pageSize = 25, |
| 2768 | adStart = 4, |
| 2769 | adRepeat = 8, |
| 2770 | minSpacing = 5, |
| 2771 | startIndex = 0, |
| 2772 | briefBannerPage, |
| 2773 | plusFeedBanner, |
| 2774 | forceAd, |
| 2775 | staticAd, |
| 2776 | disableAds, |
| 2777 | skipFirstAd, |
| 2778 | user = defaultUser, |
| 2779 | isHorizontal, |
| 2780 | feedName = SharedFeedPage.MyFeed, |
| 2781 | }: HighlightLayoutRenderParams): RenderResult => { |
| 2782 | variables = { ...defaultVariables, first: pageSize, columns: numCards }; |
| 2783 | mockGraphQL(createFeedMock(buildFeedPage(posts))); |
| 2784 | // First ad page uses active=false, subsequent pages use active=true. Mock |
| 2785 | // both up to a handful of refills so multi-ad scenarios don't run dry. |
| 2786 | nock('http://localhost:3000') |
| 2787 | .get( |
| 2788 | '/v1/a?active=false&allow_post_boost=true&allow_squad_boost=true®istered=true&gdpr=1&consent_exists=NONE_CONSENT', |
| 2789 | ) |
| 2790 | .reply(200, [ad]); |
| 2791 | nock('http://localhost:3000') |
| 2792 | .get( |
| 2793 | '/v1/a?active=true&allow_post_boost=true&allow_squad_boost=true®istered=true&gdpr=1&consent_exists=NONE_CONSENT', |
| 2794 | ) |
| 2795 | .times(10) |
| 2796 | .reply(200, [ad]); |
| 2797 | |
| 2798 | const feedContextValue: FeedContextData = { |
| 2799 | pageSize, |
| 2800 | numCards: { |
| 2801 | eco: numCards, |
| 2802 | roomy: numCards, |
| 2803 | cozy: numCards, |
| 2804 | } as FeedContextData['numCards'], |
| 2805 | adTemplate: { adStart, adRepeat }, |
| 2806 | }; |
| 2807 | |
| 2808 | const gb = new GrowthBook(); |
| 2809 | gb.setFeatures({ |
| 2810 | [featureHeroCards.id]: { |
| 2811 | defaultValue: { |
| 2812 | enabled: highlightEnabled, |
| 2813 | minSpacing, |
| 2814 | startIndex, |
| 2815 | chipLabels: {}, |
| 2816 | allowedPostTypes: { |
| 2817 | [PostType.Article]: true, |
| 2818 | [PostType.VideoYouTube]: true, |
| 2819 | [PostType.Share]: true, |
| 2820 | [PostType.Freeform]: true, |
no test coverage detected