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
2 changes: 1 addition & 1 deletion frontends/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"ol-test-utilities": "0.0.0"
},
"dependencies": {
"@mitodl/mitxonline-api-axios": "2026.5.1",
"@mitodl/mitxonline-api-axios": "2026.5.14",
"@tanstack/react-query": "^5.66.0",
"axios": "^1.12.2",
"tiny-invariant": "^1.3.3"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const program: PartialFactory<V2ProgramDetail> = (overrides = {}) => {
length: `${faker.number.int({ min: 1, max: 12 })} weeks`,
effort: `${faker.number.int({ min: 1, max: 10 })} hours/week`,
price: faker.commerce.price(),
list_price: faker.commerce.price(),
},
program_type: faker.helpers.arrayElement([
"certificate",
Expand Down
2 changes: 1 addition & 1 deletion frontends/main/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@emotion/styled": "^11.11.0",
"@floating-ui/react": "^0.27.16",
"@mitodl/course-search-utils": "^3.5.2",
"@mitodl/mitxonline-api-axios": "2026.5.1",
"@mitodl/mitxonline-api-axios": "2026.5.14",
"@mitodl/smoot-design": "^6.27.0",
"@mui/material": "^6.4.5",
"@mui/material-nextjs": "^6.4.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1280,7 +1280,7 @@ describe("ProgramSummary", () => {
expect(priceRow).not.toHaveTextContent("Earn a certificate")
})

test("Shows paid price with certificate type and no cert box when all enrollment modes are paid", () => {
test("Shows paid price with no cert box when all enrollment modes are paid", () => {
const product = factories.courses.product({ price: "1499.00" })
const program = factories.programs.program({
enrollment_modes: [paidMode()],
Expand All @@ -1292,24 +1292,28 @@ describe("ProgramSummary", () => {
expect(priceRow).toHaveTextContent(
formatPrice(product.price, { avoidCents: true }),
)
expect(priceRow).toHaveTextContent(program.certificate_type)
expect(priceRow).toHaveTextContent("full program")
expect(priceRow).not.toHaveTextContent("Free to Learn")
expect(priceRow).not.toHaveTextContent("Earn a certificate")
expect(priceRow).not.toHaveTextContent("Audit for free")
})

test("Shows 'Free to Learn' and cert box when enrollment modes include both free and paid", () => {
test("Shows paid price and 'Start for free' callout when enrollment modes include both free and paid", () => {
const program = factories.programs.program({
enrollment_modes: bothModes(),
})
invariant(program.products[0])
renderWithProviders(<ProgramSummary program={program} />)

const priceRow = screen.getByTestId(TestIds.PriceRow)
expect(priceRow).toHaveTextContent("Free to Learn")
expect(priceRow).toHaveTextContent("Earn a certificate")
expect(priceRow).toHaveTextContent("Audit for free")
expect(priceRow).toHaveTextContent("or upgrade to")
expect(priceRow).toHaveTextContent("certificate")
expect(priceRow).toHaveTextContent(
formatPrice(program.products[0].price, { avoidCents: true }),
)
expect(priceRow).not.toHaveTextContent("Free to Learn")
expect(priceRow).not.toHaveTextContent("Earn a certificate")
})

test.each([
Expand Down
Loading