Skip to content

Commit 0b33e05

Browse files
chore: fix incorrect or missing 'await' usages
1 parent 5d97a98 commit 0b33e05

13 files changed

Lines changed: 36 additions & 19 deletions

File tree

plugins/course-apps/live/Settings.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ const LiveSettings = ({
7272
};
7373

7474
const handleSettingsSave = async (values) => {
75+
// oxlint-disable-next-line @typescript-eslint/await-thenable - this IS a promise; it just has wrong type info.
7576
await dispatch(saveLiveConfiguration(courseId, values, navigate));
7677
};
7778

plugins/course-apps/ora_settings/Settings.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const ORASettings = ({ onClose }) => {
4848
event.preventDefault();
4949

5050
success = success && await handleSettingsSave(formValues);
51-
await setSaveError(!success);
51+
setSaveError(!success);
5252
if ((initialFormValues.enableFlexiblePeerGrade !== formValues.enableFlexiblePeerGrade) && success) {
5353
success = await dispatch(updateModel({
5454
modelType: 'courseApps',

plugins/course-apps/ora_settings/Settings.test.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ describe('ORASettings', () => {
128128
await mockStore({ apiStatus: 200, enabled: true });
129129
renderComponent();
130130

131-
const checkbox = await screen.getByRole('checkbox', { name: /Flex Peer Grading/ });
131+
const checkbox = screen.getByRole('checkbox', { name: /Flex Peer Grading/ });
132132
expect(checkbox).toBeChecked();
133133

134134
await waitFor(() => {

plugins/course-apps/xpert_unit_summary/settings-modal/SettingsModal.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,10 @@ const SettingsModal = ({
239239
const values = { ...rest, enabled: enabled ? checked === 'true' : undefined };
240240

241241
if (enabled) {
242+
// oxlint-disable-next-line @typescript-eslint/await-thenable - this IS a promise; it just has wrong type info.
242243
success = await dispatch(updateXpertSettings(courseId, values));
243244
} else {
245+
// oxlint-disable-next-line @typescript-eslint/await-thenable - this IS a promise; it just has wrong type info.
244246
success = await dispatch(removeXpertSettings(courseId));
245247
}
246248

src/certificates/certificates-list/hooks/useCertificatesList.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const useCertificatesList = (courseId) => {
2525
}));
2626

2727
const handleSubmit = async (values) => {
28+
// oxlint-disable-next-line @typescript-eslint/await-thenable - this IS a promise; it just has wrong type info.
2829
await dispatch(updateCourseCertificate(courseId, values));
2930
setEditModes({});
3031
dispatch(setMode(MODE_STATES.view));

src/course-checklist/CourseChecklist.test.jsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ describe('CourseChecklistPage', () => {
4646
});
4747
describe('renders', () => {
4848
describe('if enable_quality prop is true', () => {
49-
it('two checklist components ', () => {
49+
it('two checklist components ', async () => {
5050
renderComponent();
51-
mockStore(200);
51+
await mockStore(200);
5252

5353
expect(screen.getByText(messages.launchChecklistLabel.defaultMessage)).toBeVisible();
5454

@@ -67,7 +67,7 @@ describe('CourseChecklistPage', () => {
6767

6868
it('correct content when the launch checklist has loaded', async () => {
6969
renderComponent();
70-
mockStore(404);
70+
await mockStore(404);
7171
await waitFor(() => {
7272
const { launchChecklistStatus } = store.getState().courseChecklist.loadingStatus;
7373

@@ -79,7 +79,7 @@ describe('CourseChecklistPage', () => {
7979

8080
it('correct content when the best practices checklist is loading', async () => {
8181
renderComponent();
82-
mockStore(404);
82+
await mockStore(404);
8383
await waitFor(() => {
8484
const { bestPracticeChecklistStatus } = store.getState().courseChecklist.loadingStatus;
8585

@@ -100,9 +100,9 @@ describe('CourseChecklistPage', () => {
100100
});
101101
});
102102

103-
it('one checklist components ', () => {
103+
it('one checklist components ', async () => {
104104
renderComponent();
105-
mockStore(200);
105+
await mockStore(200);
106106

107107
expect(screen.getByText(messages.launchChecklistLabel.defaultMessage)).toBeVisible();
108108

@@ -112,7 +112,7 @@ describe('CourseChecklistPage', () => {
112112
describe('an aria-live region with', () => {
113113
it('correct content when the launch checklist has loaded', async () => {
114114
renderComponent();
115-
mockStore(404);
115+
await mockStore(404);
116116
await waitFor(() => {
117117
const { launchChecklistStatus } = store.getState().courseChecklist.loadingStatus;
118118

@@ -124,7 +124,7 @@ describe('CourseChecklistPage', () => {
124124

125125
it('correct content when the best practices checklist is loading', async () => {
126126
renderComponent();
127-
mockStore(404);
127+
await mockStore(404);
128128
await waitFor(() => {
129129
const { bestPracticeChecklistStatus } = store.getState().courseChecklist.loadingStatus;
130130

src/course-unit/CourseUnit.test.jsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,14 @@ import {
77
import { cloneDeep, set } from 'lodash';
88

99
import {
10-
act, fireEvent, render, waitFor, within, screen, initializeMocks,
10+
act,
11+
cleanup,
12+
fireEvent,
13+
initializeMocks,
14+
render,
15+
waitFor,
16+
within,
17+
screen,
1118
} from '@src/testUtils';
1219
import { IFRAME_FEATURE_POLICY } from '@src/constants';
1320
import { mockWaffleFlags } from '@src/data/apiHooks.mock';
@@ -790,9 +797,10 @@ describe('<CourseUnit />', () => {
790797
.reply(200, {
791798
...updatedCourseSectionVerticalData,
792799
});
800+
cleanup(); // clear the first render before we create the second.
793801
render(<RootWrapper />);
794802
// to wait for loading
795-
screen.findByTestId('unit-header-title');
803+
await screen.findByTestId('unit-header-title');
796804
// The new unit button should not be visible when childAddable is false
797805
expect(
798806
screen.queryByRole('button', { name: courseSequenceMessages.newUnitBtnText.defaultMessage }),

src/library-authoring/add-content/AddContent.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ describe('<AddContent />', () => {
9393
expect(screen.queryByRole('button', { name: /video/i })).toBeInTheDocument();
9494
expect(screen.queryByRole('button', { name: /copy from clipboard/i })).not.toBeInTheDocument();
9595
expect(await screen.findByRole('button', { name: /advanced \/ other/i })).toBeInTheDocument();
96-
expect(await screen.queryByRole('button', { name: /existing library content/i })).not.toBeInTheDocument();
96+
expect(screen.queryByRole('button', { name: /existing library content/i })).not.toBeInTheDocument();
9797
});
9898

9999
it('should render advanced content buttons', async () => {

src/library-authoring/hierarchy/ItemHierarchyPublisher.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,10 @@ export const ItemHierarchyPublisher = ({
123123
{intl.formatMessage(messages.publishCancel)}
124124
</Button>
125125
<LoadingButton
126-
onClick={async (e) => {
126+
onClick={(e) => {
127127
e.preventDefault();
128128
e.stopPropagation();
129-
await handlePublish();
129+
handlePublish();
130130
}}
131131
variant="primary rounded-0"
132132
label={intl.formatMessage(messages.publishConfirm)}

src/library-authoring/import-course/ImportDetailsPage.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ describe('<ImportDetailsPage />', () => {
104104
name: /view imported content/i,
105105
});
106106

107-
await viewImportedContentBtn.click();
107+
viewImportedContentBtn.click();
108108
await waitFor(() => expect(mockNavigate).toHaveBeenCalledWith('/library/lib:Axim:TEST/collection/coll'));
109109
});
110110

0 commit comments

Comments
 (0)