Skip to content

Commit 5ac5dbf

Browse files
authored
alter org page header based on new requirements (#2659)
1 parent 99b6b1c commit 5ac5dbf

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

frontends/main/src/app-pages/DashboardPage/CoursewareDisplay/test-utils.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const makeProgram = factories.programs.program
2626
const makeProgramCollection = factories.programs.programCollection
2727
const makeCourseEnrollment = factories.enrollment.courseEnrollment
2828
const makeGrade = factories.enrollment.grade
29+
const makeContract = factories.contracts.contract
2930

3031
const dashboardCourse: PartialFactory<DashboardCourse> = (...overrides) => {
3132
return mergeOverrides<DashboardCourse>(
@@ -127,6 +128,11 @@ const setupEnrollments = (includeExpired: boolean) => {
127128
const setupProgramsAndCourses = () => {
128129
const user = u.factories.user.user()
129130
const orgX = factories.organizations.organization({ name: "Org X" })
131+
const contract = makeContract({
132+
organization: orgX.id,
133+
name: "Org X Contract",
134+
})
135+
orgX.contracts = [contract]
130136
const mitxOnlineUser = factories.user.user({ b2b_organizations: [orgX] })
131137
setMockResponse.get(u.urls.userMe.get(), user)
132138
setMockResponse.get(urls.userMe.get(), mitxOnlineUser)

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@ describe("OrganizationContent", () => {
3737
renderWithProviders(<OrganizationContent orgSlug={orgX.slug} />)
3838

3939
await screen.findByRole("heading", {
40-
name: `Your ${orgX.name} Home`,
40+
name: orgX.name,
4141
})
42+
await screen.findByText(orgX.contracts[0].name)
4243

4344
const programAHeader = await screen.findByText(programA.title)
4445
const programBHeader = await screen.findByText(programB.title)
@@ -300,8 +301,9 @@ describe("OrganizationContent", () => {
300301

301302
// Wait for the header to appear
302303
await screen.findByRole("heading", {
303-
name: `Your ${orgX.name} Home`,
304+
name: orgX.name,
304305
})
306+
await screen.findByText(orgX.contracts[0].name)
305307

306308
// Since there are no programs or collections, no program/collection components should be rendered
307309
const programs = screen.queryAllByTestId("org-program-root")
@@ -331,8 +333,9 @@ describe("OrganizationContent", () => {
331333

332334
// Wait for the header to appear
333335
await screen.findByRole("heading", {
334-
name: `Your ${orgX.name} Home`,
336+
name: orgX.name,
335337
})
338+
await screen.findByText(orgX.contracts[0].name)
336339

337340
// Should have no collections
338341
const collections = screen.queryAllByTestId("org-program-collection-root")

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,10 @@ const OrganizationHeader: React.FC<{ org?: OrganizationPage }> = ({ org }) => {
6868
</ImageContainer>
6969
<Stack gap="8px">
7070
<Typography variant="h3" component="h1">
71-
Your {org?.name} Home
71+
{org?.name}
7272
</Typography>
73-
<Typography variant="body1">MIT courses for {org?.name}</Typography>
73+
{/* For now we will use the first contract name until we refactor this to be based on contracts / offerings */}
74+
<Typography variant="body1">{org?.contracts[0]?.name}</Typography>
7475
</Stack>
7576
</HeaderRoot>
7677
)

0 commit comments

Comments
 (0)