-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: course about URL should use course key, not course run key.
When the spent table was first implemented, it utilized the Analytics API to fetch enrollments, and that data source contained a course key field. However, when we switched over to real-time fetching of redemptions via the transaction list API for assignable budgets, we erroneously treated the `content_key` field as a course key, breaking the course about page link in the spent table. The following two PRs implment a `parent_content_key` field in the transaction list API, which we can now utilize for the real-time spent table implmentation: * openedx/openedx-ledger#60 * openedx/enterprise-subsidy#209 ENT-8389
- Loading branch information
Showing
3 changed files
with
30 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
import { QueryClientProvider } from '@tanstack/react-query'; | ||
import { act, renderHook } from '@testing-library/react-hooks/dom'; | ||
import { camelCaseObject } from '@edx/frontend-platform/utils'; | ||
import { v4 as uuidv4 } from 'uuid'; | ||
|
||
import useBudgetRedemptions from '../useBudgetRedemptions'; | ||
import useSubsidyAccessPolicy from '../useSubsidyAccessPolicy'; | ||
|
@@ -10,8 +11,11 @@ import { queryClient } from '../../../../test/testUtils'; | |
|
||
const TEST_ENTERPRISE_UUID = 'test-enterprise-uuid'; | ||
const TEST_ENTERPRISE_OFFER_ID = 1; | ||
const subsidyUuid = 'test-subsidy-uuid'; | ||
const subsidyUuid = uuidv4(); | ||
const transactionUuid = uuidv4(); | ||
const courseTitle = 'Test Course Title'; | ||
const courseKey = 'edX+test'; | ||
const courseRunKey = `course-v1:${courseKey}+course.1`; | ||
const userEmail = '[email protected]'; | ||
|
||
const mockOfferEnrollments = [{ | ||
|
@@ -33,14 +37,15 @@ const mockSubsidyTransactionResponse = { | |
current_page: 1, | ||
num_pages: 5, | ||
results: [{ | ||
uuid: subsidyUuid, | ||
uuid: transactionUuid, | ||
state: 'committed', | ||
idempotency_key: '5d00d319-fe46-41f7-b14e-966534da9f72', | ||
idempotency_key: 'does-not-matter', | ||
lms_user_id: 999, | ||
lms_user_email: userEmail, | ||
content_key: 'course-v1:edX+test+course.1', | ||
content_key: courseRunKey, | ||
parent_content_key: courseKey, | ||
content_title: courseTitle, | ||
quantity: -1000, | ||
quantity: -1500, | ||
unit: 'usd_cents', | ||
}], | ||
}; | ||
|
@@ -145,7 +150,8 @@ describe('useBudgetRedemptions', () => { | |
} | ||
|
||
const mockExpectedResultsObj = isTopDownAssignmentEnabled ? [{ | ||
courseListPrice: 10, | ||
courseListPrice: 15, | ||
courseKey, | ||
courseTitle, | ||
userEmail, | ||
}] : camelCaseObject(mockOfferEnrollments); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters