@@ -4,21 +4,16 @@ import {
44 getByRole ,
55 getAllByRole ,
66 waitForElementToBeRemoved ,
7- } from '@testing-library/react' ;
7+ initializeMocks ,
8+ } from 'CourseAuthoring/testUtils' ;
89
910import ReactDOM from 'react-dom' ;
10- import { Routes , Route , MemoryRouter } from 'react-router-dom' ;
11- import { initializeMockApp } from '@edx/frontend-platform' ;
12- import MockAdapter from 'axios-mock-adapter' ;
13- import { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth' ;
14- import { AppProvider , PageWrap } from '@edx/frontend-platform/react' ;
15- import { IntlProvider } from '@edx/frontend-platform/i18n' ;
1611
1712import userEvent from '@testing-library/user-event' ;
18- import initializeStore from 'CourseAuthoring/store' ;
1913import { executeThunk } from 'CourseAuthoring/utils' ;
2014import PagesAndResourcesProvider from 'CourseAuthoring/pages-and-resources/PagesAndResourcesProvider' ;
2115
16+ import { CourseAuthoringProvider } from '@src/CourseAuthoringContext' ;
2217import LiveSettings from './Settings' ;
2318import {
2419 generateLiveConfigurationApiResponse ,
@@ -40,17 +35,20 @@ ReactDOM.createPortal = jest.fn(node => node);
4035
4136const renderComponent = ( ) => {
4237 const wrapper = render (
43- < IntlProvider locale = "en" >
44- < AppProvider store = { store } wrapWithRouter = { false } >
45- < PagesAndResourcesProvider courseId = { courseId } >
46- < MemoryRouter initialEntries = { [ liveSettingsUrl ] } >
47- < Routes >
48- < Route path = { liveSettingsUrl } element = { < PageWrap > < LiveSettings onClose = { ( ) => { } } /> </ PageWrap > } />
49- </ Routes >
50- </ MemoryRouter >
51- </ PagesAndResourcesProvider >
52- </ AppProvider >
53- </ IntlProvider > ,
38+ < CourseAuthoringProvider courseId = { courseId } >
39+ < PagesAndResourcesProvider courseId = { courseId } >
40+ < LiveSettings onClose = { ( ) => { } } />
41+ </ PagesAndResourcesProvider >
42+ </ CourseAuthoringProvider > ,
43+ {
44+ path : liveSettingsUrl ,
45+ routerProps : {
46+ initialEntries : [ liveSettingsUrl ] ,
47+ } ,
48+ params : {
49+ courseId,
50+ } ,
51+ } ,
5452 ) ;
5553 container = wrapper . container ;
5654} ;
@@ -74,16 +72,9 @@ const mockStore = async ({
7472
7573describe ( 'BBB Settings' , ( ) => {
7674 beforeEach ( async ( ) => {
77- initializeMockApp ( {
78- authenticatedUser : {
79- userId : 3 ,
80- username : 'abc123' ,
81- administrator : false ,
82- roles : [ ] ,
83- } ,
84- } ) ;
85- store = initializeStore ( initialState ) ;
86- axiosMock = new MockAdapter ( getAuthenticatedHttpClient ( ) ) ;
75+ const mocks = initializeMocks ( { initialState } ) ;
76+ store = mocks . reduxStore ;
77+ axiosMock = mocks . axiosMock ;
8778 } ) ;
8879
8980 test ( 'Plan dropdown to be visible and enabled in UI' , async ( ) => {
0 commit comments