Skip to content

Commit ffd064b

Browse files
chore: remove video-shorts feature flag (#3537)
1 parent 1a86a62 commit ffd064b

4 files changed

Lines changed: 25 additions & 49 deletions

File tree

frontends/main/src/app-pages/HomePage/HomePage.test.tsx

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,13 @@ import { useFeatureFlagEnabled, usePostHog } from "posthog-js/react"
2222
import { PostHogEvents } from "@/common/constants"
2323

2424
jest.mock("posthog-js/react")
25+
jest.mock("ol-components/CarouselV2", () => ({
26+
CarouselV2: ({ children }: { children: React.ReactNode }) => (
27+
<div>{children}</div>
28+
),
29+
}))
2530
const mockedUseFeatureFlagEnabled = jest.mocked(useFeatureFlagEnabled)
2631
const mockedPostHogCapture = jest.fn()
27-
jest.mock("posthog-js/react")
2832
jest.mocked(usePostHog).mockReturnValue(
2933
// @ts-expect-error Not mocking all of posthog
3034
{ capture: mockedPostHogCapture },
@@ -91,6 +95,13 @@ const setupAPIs = () => {
9195
attestations,
9296
)
9397

98+
setMockResponse.get(expect.stringContaining(urls.search.resources()), {
99+
count: 0,
100+
next: null,
101+
previous: null,
102+
results: [],
103+
})
104+
94105
mockedUseFeatureFlagEnabled.mockReturnValue(false)
95106
return { featured, media }
96107
}
@@ -417,22 +428,27 @@ describe("Home Page Carousel", () => {
417428

418429
renderWithProviders(<HomePage heroImageIndex={1} />)
419430

420-
await screen.findAllByRole("tablist").then(([featured, media]) => {
431+
await screen.findAllByRole("tablist").then(([featured]) => {
421432
within(featured).getByRole("tab", { name: "All" })
422433
within(featured).getByRole("tab", { name: "Free" })
423434
within(featured).getByRole("tab", { name: "With Certificate" })
424435
within(featured).getByRole("tab", {
425436
name: "Professional & Executive Learning",
426437
})
427-
within(media).getByRole("tab", { name: "All" })
428-
within(media).getByRole("tab", { name: "Videos" })
429-
within(media).getByRole("tab", { name: "Podcasts" })
430438
})
431439
})
432440
})
433441

434442
test("Headings", async () => {
435-
const { featured, media } = setupAPIs()
443+
const { featured } = setupAPIs()
444+
445+
const videoShorts = [learningResources.video(), learningResources.video()]
446+
setMockResponse.get(expect.stringContaining(urls.search.resources()), {
447+
count: videoShorts.length,
448+
next: null,
449+
previous: null,
450+
results: videoShorts,
451+
})
436452

437453
renderWithProviders(<HomePage heroImageIndex={1} />)
438454
await waitFor(() => {
@@ -442,8 +458,7 @@ test("Headings", async () => {
442458
// Featured course order is randomized on frontend, so just check for presence
443459
...featured.results.map(() => ({ level: 3, name: expect.any(String) })),
444460
{ level: 2, name: "Continue Your Journey" },
445-
{ level: 2, name: "Media" },
446-
...media.results.map((result) => ({ level: 3, name: result.title })),
461+
{ level: 2, name: "MIT Learning Moments" },
447462
{ level: 2, name: "Browse by Topic" },
448463
{ level: 2, name: "From Our Community" },
449464
{ level: 2, name: "MIT News & Events" },

frontends/main/src/app-pages/HomePage/HomePage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const LearningResourceDrawer = dynamic(
4141
import("@/page-components/LearningResourceDrawer/LearningResourceDrawer"),
4242
)
4343

44-
const MediaSection = dynamic(() => import("./MediaSection"))
44+
const VideoShortsSection = dynamic(() => import("./VideoShortsSection"))
4545

4646
const HomePage: React.FC<{ heroImageIndex: number }> = ({ heroImageIndex }) => {
4747
return (
@@ -61,7 +61,7 @@ const HomePage: React.FC<{ heroImageIndex: number }> = ({ heroImageIndex }) => {
6161
</StyledContainer>
6262
</FullWidthBackground>
6363
<PersonalizeSection />
64-
<MediaSection />
64+
<VideoShortsSection />
6565
<BrowseTopicsSection />
6666
<TestimonialsSection />
6767
<NewsEventsSection />

frontends/main/src/app-pages/HomePage/MediaSection.tsx

Lines changed: 0 additions & 38 deletions
This file was deleted.

frontends/main/src/common/feature_flags.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ export enum FeatureFlags {
99
HomePageRecommendationBot = "home-page-recommendation-bot",
1010
UniversalAI = "universal-ai",
1111
UniversalAISearchBanner = "universal-ai-search-banner",
12-
VideoShorts = "video-shorts",
1312
CourseOutlineSection = "course-outline-section",
1413
OcwProductPages = "ocw-product-pages",
1514
VideoPlaylistPage = "video-playlist-page",

0 commit comments

Comments
 (0)