Skip to content

Commit 65f4d7a

Browse files
farhanclaude
andcommitted
test: remove references to deleted legacy waffle flags from test files
Updates apiHooks.test.tsx to use useReactMarkdownEditor as the example flag (still present, default true). Removes useNewCourseOutlinePage and useNewVideoUploadsPage from all test mocks and HTTP response fixtures. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 56779f1 commit 65f4d7a

7 files changed

Lines changed: 16 additions & 24 deletions

File tree

src/course-checklist/ChecklistSection/ChecklistSection.test.jsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@ describe('ChecklistSection', () => {
3939
const { axiosMock } = initializeMocks();
4040
axiosMock
4141
.onGet(getApiWaffleFlagsUrl(courseId))
42-
.reply(200, {
43-
useNewCourseOutlinePage: true,
44-
});
42+
.reply(200, {});
4543
});
4644

4745
it('a heading using the dataHeading prop', () => {

src/course-unit/breadcrumbs/Breadcrumbs.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ describe('<Breadcrumbs />', () => {
5353
await executeThunk(fetchCourseSectionVerticalData(courseId), reduxStore.dispatch);
5454
axiosMock
5555
.onGet(getApiWaffleFlagsUrl(courseId))
56-
.reply(200, { useNewCourseOutlinePage: true });
56+
.reply(200, {});
5757
});
5858

5959
it('render Breadcrumbs component correctly', async () => {

src/custom-pages/CustomPages.test.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,7 @@ describe('CustomPages', () => {
6161
axiosMock = mocks.axiosMock;
6262
axiosMock
6363
.onGet(getApiWaffleFlagsUrl(courseId))
64-
.reply(200, {
65-
useNewCourseOutlinePage: true,
66-
});
64+
.reply(200, {});
6765
});
6866
it('should ', async () => {
6967
renderComponent();

src/data/apiHooks.mock.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import * as apiHooks from './apiHooks';
77
* loading; if you need more realistic handling, use:
88
* axiosMock
99
* .onGet(getApiWaffleFlagsUrl(courseId))
10-
* .reply(200, { useNewCourseOutlinePage: true }); // etc
10+
* .reply(200, { enableCourseOptimizer: true }); // etc
1111
*/
1212
export function mockWaffleFlags(overrides: Partial<Record<WaffleFlagName, boolean>> = {}) {
1313
return jest.spyOn(apiHooks, 'useWaffleFlags').mockImplementation(() => ({

src/data/apiHooks.test.tsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -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
});

src/header/hooks.test.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ describe('header utils', () => {
8585
it('when video upload page disabled should not include Video Uploads option', () => {
8686
mockWaffleFlags({
8787
enableAuthzCourseAuthoring: false,
88-
useNewVideoUploadsPage: false,
8988
});
9089
jest.mocked(useCourseUserPermissions).mockReturnValue({
9190
isLoading: false,
@@ -237,7 +236,6 @@ describe('header utils', () => {
237236
beforeAll(() => {
238237
mockWaffleFlags({
239238
enableAuthzCourseAuthoring: false,
240-
useNewVideoUploadsPage: false,
241239
});
242240
});
243241
beforeEach(() => {

src/pages-and-resources/pages/PageCard.test.jsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ describe('LiveSettings', () => {
5050
axiosMock = mocks.axiosMock;
5151
axiosMock
5252
.onGet(getApiWaffleFlagsUrl(courseId))
53-
.reply(200, {
54-
useNewCourseOutlinePage: true,
55-
});
53+
.reply(200, {});
5654
});
5755

5856
it('should render three cards', async () => {

0 commit comments

Comments
 (0)