@@ -15,7 +15,7 @@ const FlagComponent = ({ courseId }: { courseId?: string; }) => {
1515 < ul >
1616 < li aria-label = "isLoading" > { waffleFlags . isLoading ? 'loading' : 'false' } </ li >
1717 < li aria-label = "isError" > { waffleFlags . isError ? 'error' : 'false' } </ li >
18- < li aria-label = "useNewCourseOutlinePage " > { waffleFlags . useNewCourseOutlinePage ? 'enabled' : 'disabled' } </ li >
18+ < li aria-label = "useReactMarkdownEditor " > { waffleFlags . useReactMarkdownEditor ? 'enabled' : 'disabled' } </ li >
1919 </ ul >
2020 ) ;
2121} ;
@@ -34,17 +34,17 @@ describe('useWaffleFlags', () => {
3434 expect ( await screen . findByLabelText ( 'isLoading' ) ) . toHaveTextContent ( 'loading' ) ;
3535 expect ( await screen . findByLabelText ( 'isError' ) ) . toHaveTextContent ( 'false' ) ;
3636 // The default should be enabled, even before we hear back from the server:
37- expect ( await screen . findByLabelText ( 'useNewCourseOutlinePage ' ) ) . toHaveTextContent ( 'enabled' ) ;
37+ expect ( await screen . findByLabelText ( 'useReactMarkdownEditor ' ) ) . toHaveTextContent ( 'enabled' ) ;
3838
3939 // Then, the server responds with a new value:
40- resolveResponse ( [ 200 , { useNewCourseOutlinePage : false } ] ) ;
40+ resolveResponse ( [ 200 , { useReactMarkdownEditor : false } ] ) ;
4141
4242 // Now, we're no longer loading and we have the new value:
4343 await waitFor ( async ( ) => {
4444 expect ( await screen . findByLabelText ( 'isLoading' ) ) . toHaveTextContent ( 'false' ) ;
4545 } ) ;
4646 expect ( await screen . findByLabelText ( 'isError' ) ) . toHaveTextContent ( 'false' ) ;
47- expect ( await screen . findByLabelText ( 'useNewCourseOutlinePage ' ) ) . toHaveTextContent ( 'disabled' ) ;
47+ expect ( await screen . findByLabelText ( 'useReactMarkdownEditor ' ) ) . toHaveTextContent ( 'disabled' ) ;
4848 } ) ;
4949
5050 it ( 'uses the default values if there\'s an error' , async ( ) => {
@@ -60,7 +60,7 @@ describe('useWaffleFlags', () => {
6060 expect ( await screen . findByLabelText ( 'isLoading' ) ) . toHaveTextContent ( 'loading' ) ;
6161 expect ( await screen . findByLabelText ( 'isError' ) ) . toHaveTextContent ( 'false' ) ;
6262 // The default should be enabled, even before we hear back from the server:
63- expect ( await screen . findByLabelText ( 'useNewCourseOutlinePage ' ) ) . toHaveTextContent ( 'enabled' ) ;
63+ expect ( await screen . findByLabelText ( 'useReactMarkdownEditor ' ) ) . toHaveTextContent ( 'enabled' ) ;
6464
6565 // Then, the server responds with an error
6666 resolveResponse ( [ 500 , { } ] ) ;
@@ -70,14 +70,14 @@ describe('useWaffleFlags', () => {
7070 expect ( await screen . findByLabelText ( 'isLoading' ) ) . toHaveTextContent ( 'false' ) ;
7171 } ) ;
7272 expect ( await screen . findByLabelText ( 'isError' ) ) . toHaveTextContent ( 'error' ) ;
73- expect ( await screen . findByLabelText ( 'useNewCourseOutlinePage ' ) ) . toHaveTextContent ( 'enabled' ) ;
73+ expect ( await screen . findByLabelText ( 'useReactMarkdownEditor ' ) ) . toHaveTextContent ( 'enabled' ) ;
7474 } ) ;
7575
7676 it ( 'uses the global flag values while loading the course-specific flags' , async ( ) => {
7777 const { axiosMock } = initializeMocks ( ) ;
7878 const courseId = 'course-v1:A+b+C' ;
7979 // Set the global flag OFF:
80- axiosMock . onGet ( getApiWaffleFlagsUrl ( ) ) . reply ( 200 , { useNewCourseOutlinePage : false } ) ;
80+ axiosMock . onGet ( getApiWaffleFlagsUrl ( ) ) . reply ( 200 , { useReactMarkdownEditor : false } ) ;
8181 // Control when we respond with the course-specific flag value:
8282 let resolveResponse ;
8383 const promise = new Promise < [ number , unknown ] > ( resolve => {
@@ -89,7 +89,7 @@ describe('useWaffleFlags', () => {
8989 render ( < FlagComponent /> ) ;
9090 await waitFor ( async ( ) => {
9191 // Once it loads the flags from the server, the global 'false' value will override the default 'true':
92- expect ( await screen . findByLabelText ( 'useNewCourseOutlinePage ' ) ) . toHaveTextContent ( 'disabled' ) ;
92+ expect ( await screen . findByLabelText ( 'useReactMarkdownEditor ' ) ) . toHaveTextContent ( 'disabled' ) ;
9393 } ) ;
9494
9595 // Now check the course-specific flag:
@@ -99,14 +99,14 @@ describe('useWaffleFlags', () => {
9999 // Now, the course-specific value is loading but in the meantime we use the global default:
100100 expect ( await screen . findByLabelText ( 'isLoading' ) ) . toHaveTextContent ( 'loading' ) ;
101101 expect ( await screen . findByLabelText ( 'isError' ) ) . toHaveTextContent ( 'false' ) ;
102- expect ( await screen . findByLabelText ( 'useNewCourseOutlinePage ' ) ) . toHaveTextContent ( 'disabled' ) ;
102+ expect ( await screen . findByLabelText ( 'useReactMarkdownEditor ' ) ) . toHaveTextContent ( 'disabled' ) ;
103103
104104 // Now the server responds: the course-specific flag is ON:
105- resolveResponse ( [ 200 , { useNewCourseOutlinePage : true } ] ) ;
105+ resolveResponse ( [ 200 , { useReactMarkdownEditor : true } ] ) ;
106106 await waitFor ( async ( ) => {
107107 expect ( await screen . findByLabelText ( 'isLoading' ) ) . toHaveTextContent ( 'false' ) ;
108108 } ) ;
109109 expect ( await screen . findByLabelText ( 'isError' ) ) . toHaveTextContent ( 'false' ) ;
110- expect ( await screen . findByLabelText ( 'useNewCourseOutlinePage ' ) ) . toHaveTextContent ( 'enabled' ) ;
110+ expect ( await screen . findByLabelText ( 'useReactMarkdownEditor ' ) ) . toHaveTextContent ( 'enabled' ) ;
111111 } ) ;
112112} ) ;
0 commit comments