Skip to content

Commit 6a3d849

Browse files
committed
add another test to ensure programs that are part of a collection are not rendered on their own
1 parent 21c7aeb commit 6a3d849

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

frontends/main/src/app-pages/DashboardPage/OrganizationContent.test.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,4 +118,23 @@ describe("OrganizationContent", () => {
118118
expect(collection.getAllByText(coursesA[0].title).length).toBeGreaterThan(0)
119119
expect(collection.getAllByText(coursesB[0].title).length).toBeGreaterThan(0)
120120
})
121+
122+
test("Does not render a program separately if it is part of a collection", async () => {
123+
const { orgX, programA, programB, programCollection } =
124+
setupProgramsAndCourses()
125+
setMockResponse.get(urls.enrollment.enrollmentsList(), [])
126+
programCollection.programs = [programA.id, programB.id]
127+
setMockResponse.get(urls.programCollections.programCollectionsList(), {
128+
results: [programCollection],
129+
})
130+
131+
renderWithProviders(<OrganizationContent orgSlug={orgX.slug} />)
132+
133+
const collectionItems = await screen.findAllByTestId(
134+
"org-program-collection-root",
135+
)
136+
expect(collectionItems.length).toBe(1)
137+
const programs = screen.queryAllByTestId("org-program-root")
138+
expect(programs.length).toBe(0)
139+
})
121140
})

0 commit comments

Comments
 (0)