feat: merge JS config variables in initialized config
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
import { mergeConfig } from '@edx/frontend-platform';
|
||||
import envConfig from 'env.config';
|
||||
|
||||
const configuration = {
|
||||
// BASE_URL: process.env.BASE_URL,
|
||||
LMS_BASE_URL: process.env.LMS_BASE_URL,
|
||||
@@ -20,6 +23,9 @@ const configuration = {
|
||||
ENABLE_EDX_PERSONAL_DASHBOARD: process.env.ENABLE_EDX_PERSONAL_DASHBOARD === 'true',
|
||||
};
|
||||
|
||||
// This mergeConfig ensures that any variables assigned by process.env are still overwritten if declared in JS config
|
||||
mergeConfig(envConfig);
|
||||
|
||||
const features = {};
|
||||
|
||||
export { configuration, features };
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
import '@testing-library/jest-dom';
|
||||
import '@testing-library/jest-dom/extend-expect';
|
||||
// import { mergeConfig } from '@edx/frontend-platform';
|
||||
// import envConfig from '../env.config';
|
||||
|
||||
// mergeConfig(envConfig);
|
||||
|
||||
jest.mock('react', () => ({
|
||||
...jest.requireActual('react'),
|
||||
@@ -66,23 +62,6 @@ jest.mock('@edx/frontend-platform/i18n', () => {
|
||||
};
|
||||
});
|
||||
|
||||
/*
|
||||
When .env.test is removed, uncomment the env vars below and add any environment variables for testing with Jest
|
||||
|
||||
Context: Snapshot is not currently set up to be able to parse the environment variables in env.config.js
|
||||
*/
|
||||
|
||||
jest.mock('@edx/frontend-platform', () => ({
|
||||
getConfig: jest.fn(() => ({
|
||||
LMS_BASE_URL: 'http://localhost:18000',
|
||||
LOGOUT_URL: 'http://localhost:18000/logout',
|
||||
LOGO_URL: 'https://edx-cdn.org/v3/default/logo.svg',
|
||||
MARKETING_SITE_BASE_URL: 'http://localhost:18000',
|
||||
SUPPORT_URL: 'http://localhost:18000/support',
|
||||
OPTIMIZELY_FULL_STACK_SDK_KEY: 'SDK Key',
|
||||
})),
|
||||
}));
|
||||
|
||||
jest.mock('@openedx/paragon', () => jest.requireActual('testUtils').mockNestedComponents({
|
||||
Alert: {
|
||||
Heading: 'Alert.Heading',
|
||||
|
||||
Reference in New Issue
Block a user