fix: mock variables for jest test

This commit is contained in:
Jason Wesson
2024-03-18 21:19:21 +00:00
parent ec7069b02d
commit 8d6204a4a6

View File

@@ -1,10 +1,10 @@
/* 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';
// import { mergeConfig } from '@edx/frontend-platform';
// import envConfig from '../env.config';
mergeConfig(envConfig);
// mergeConfig(envConfig);
jest.mock('react', () => ({
...jest.requireActual('react'),
@@ -72,16 +72,16 @@ When .env.test is removed, uncomment the env vars below and add any environment
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('@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: {