Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions frontends/main/src/app-pages/DashboardPage/ContractContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import { matchOrganizationBySlug } from "@/common/utils"
import { ResourceType, getKey } from "./CoursewareDisplay/helpers"
import {
getDistinctDashboardLanguageOptions,
resolveSlotForLanguage,
resolveCourseEntryForLanguage,
} from "./CoursewareDisplay/model/dashboardViewModel"
import UnstyledRawHTML from "@/components/UnstyledRawHTML/UnstyledRawHTML"

Expand Down Expand Up @@ -397,12 +397,13 @@ const OrgProgramCollectionDisplay: React.FC<{
enrollments?.filter(
(enrollment) => enrollment.b2b_contract_id === contract.id,
) ?? []
const { displayedEnrollment, displayedRun } = resolveSlotForLanguage(
course,
contractEnrollments,
selectedLanguageKey,
{ contractId: contract.id },
)
const { displayedEnrollment, displayedRun } =
resolveCourseEntryForLanguage(
course,
contractEnrollments,
selectedLanguageKey,
{ contractId: contract.id },
)

const resource = displayedEnrollment
? {
Expand Down Expand Up @@ -508,7 +509,7 @@ const OrgProgramDisplay: React.FC<{
(enrollment) => enrollment.b2b_contract_id === contract?.id,
) ?? []
const { displayedEnrollment, displayedRun } =
resolveSlotForLanguage(
resolveCourseEntryForLanguage(
course,
contractEnrollments,
selectedLanguageKey,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/**
* Test layering — what belongs in THIS file:
*
* 1. Smoke / seam tests for the HomeEnrollmentsDisplay <-> useHomeDashboardData
* integration: that the hook's output actually renders (e.g. N enrollments
* -> N cards). Only the rendered component proves the seam — the hook test
* asserts the data, not that it renders.
* 2. Genuine component-level concerns: simple display cases, a11y
* roles/headings, user interactions (context-menu clicks, "Show all"
* expand/collapse, empty / "My Learning" states).
*
* Exhaustive case coverage — bucketing, ordering, dedup, B2B filtering,
* completion math, language-key resolution — belongs in the pure model
* (model/dashboardViewModel.test.ts) or the hook tests
* (hooks/useHomeDashboardData.test.tsx), NOT here.
*/
import React from "react"
import { act } from "@testing-library/react"
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
/**
* Test layering — what belongs in THIS file:
*
* 1. Smoke / seam tests for the ProgramEnrollmentDisplay <->
* useProgramDashboardData integration: that the hook's output actually
* renders (sections -> cards, the right kind per item). Only the rendered
* component proves the seam.
* 2. Genuine component-level concerns: simple display cases, a11y
* roles/headings, user interactions (enroll dialog, certificate button,
* language <select>), 404 / not-enrolled state.
*
* Exhaustive case coverage — req-tree ordering, completion/elective caps,
* language-key resolution, program-as-course derivation — belongs in the
* pure model (model/dashboardViewModel.test.ts) or the hook tests
* (hooks/useProgramDashboardData.test.tsx, useDashboardLanguagePicker.test.ts),
* NOT here.
*/

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many tests in this file fall outside the categories noted above, but are left in place as a safety net during the refactor.

import React from "react"
import { waitFor } from "@testing-library/react"
import {
Expand Down
Loading
Loading