diff --git a/.env.test b/.env.test index 642dcbf25..90ee71a16 100644 --- a/.env.test +++ b/.env.test @@ -1,5 +1,6 @@ ACCESS_TOKEN_COOKIE_NAME='edx-jwt-cookie-header-payload' BASE_URL='localhost:1995' +COMMERCE_COORDINATOR_ORDER_DETAILS_URL='http://localhost:8140/lms/order_details_page_redirect' CREDENTIALS_BASE_URL='http://localhost:18150' CSRF_TOKEN_API_PATH='/csrf/api/v1/token' ENTERPRISE_ACCESS_BASE_URL='http://localhost:18270' diff --git a/src/setupTest.js b/src/setupTest.js index db5a3fac9..bd3729ae8 100755 --- a/src/setupTest.js +++ b/src/setupTest.js @@ -8,6 +8,7 @@ import { MockAuthService } from '@edx/frontend-platform/auth'; Enzyme.configure({ adapter: new Adapter() }); mergeConfig({ + COMMERCE_COORDINATOR_ORDER_DETAILS_URL: process.env.COMMERCE_COORDINATOR_ORDER_DETAILS_URL || null, LICENSE_MANAGER_URL: process.env.LICENSE_MANAGER_URL, PREDEFINED_CATALOG_QUERIES: { everything: 1, diff --git a/src/users/enrollments/Enrollments.test.jsx b/src/users/enrollments/Enrollments.test.jsx index f549a5f9d..cc83c39ed 100644 --- a/src/users/enrollments/Enrollments.test.jsx +++ b/src/users/enrollments/Enrollments.test.jsx @@ -1,11 +1,20 @@ import { mount } from 'enzyme'; import React from 'react'; +import { getConfig } from '@edx/frontend-platform'; import Enrollments from './Enrollments'; import { enrollmentsData } from '../data/test/enrollments'; import UserMessagesProvider from '../../userMessages/UserMessagesProvider'; import { waitForComponentToPaint } from '../../setupTest'; import * as api from '../data/api'; +jest.mock('@edx/frontend-platform', () => ({ + ...jest.requireActual('@edx/frontend-platform'), + getConfig: jest.fn(() => ({ + ECOMMERCE_BASE_URL: 'http://example.com', + COMMERCE_COORDINATOR_ORDER_DETAILS_URL: 'http://example.com/coordinater/', + })), +})); + const EnrollmentPageWrapper = (props) => ( @@ -123,6 +132,10 @@ describe('Course Enrollments Listing', () => { }); it('Enterprise course enrollments table is not rendered if are no enterprise course enrollments', async () => { + getConfig.mockReturnValue({ + ECOMMERCE_BASE_URL: 'http://example.com', + COMMERCE_COORDINATOR_ORDER_DETAILS_URL: null, + }); const mockEnrollments = [{ ...enrollmentsData[0], enterpriseCourseEnrollments: [],