Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions plugins/course-apps/live/Settings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ const LiveSettings = ({
};

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

Expand Down
2 changes: 1 addition & 1 deletion plugins/course-apps/ora_settings/Settings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const ORASettings = ({ onClose }) => {
event.preventDefault();

success = success && await handleSettingsSave(formValues);
await setSaveError(!success);
setSaveError(!success);
if ((initialFormValues.enableFlexiblePeerGrade !== formValues.enableFlexiblePeerGrade) && success) {
success = await dispatch(updateModel({
modelType: 'courseApps',
Expand Down
2 changes: 1 addition & 1 deletion plugins/course-apps/ora_settings/Settings.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ describe('ORASettings', () => {
await mockStore({ apiStatus: 200, enabled: true });
renderComponent();

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

await waitFor(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,10 @@ const SettingsModal = ({
const values = { ...rest, enabled: enabled ? checked === 'true' : undefined };

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const useCertificatesList = (courseId) => {
}));

const handleSubmit = async (values) => {
// oxlint-disable-next-line @typescript-eslint/await-thenable - this IS a promise; it just has wrong type info.
await dispatch(updateCourseCertificate(courseId, values));
setEditModes({});
dispatch(setMode(MODE_STATES.view));
Expand Down
16 changes: 8 additions & 8 deletions src/course-checklist/CourseChecklist.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ describe('CourseChecklistPage', () => {
});
describe('renders', () => {
describe('if enable_quality prop is true', () => {
it('two checklist components ', () => {
it('two checklist components ', async () => {
renderComponent();
mockStore(200);
await mockStore(200);

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

Expand All @@ -81,7 +81,7 @@ describe('CourseChecklistPage', () => {

it('correct content when the launch checklist has loaded', async () => {
renderComponent();
mockStore(404);
await mockStore(404);
await waitFor(() => {
const { launchChecklistStatus } = store.getState().courseChecklist.loadingStatus;

Expand All @@ -93,7 +93,7 @@ describe('CourseChecklistPage', () => {

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

Expand All @@ -114,9 +114,9 @@ describe('CourseChecklistPage', () => {
});
});

it('one checklist components ', () => {
it('one checklist components ', async () => {
renderComponent();
mockStore(200);
await mockStore(200);

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

Expand All @@ -126,7 +126,7 @@ describe('CourseChecklistPage', () => {
describe('an aria-live region with', () => {
it('correct content when the launch checklist has loaded', async () => {
renderComponent();
mockStore(404);
await mockStore(404);
await waitFor(() => {
const { launchChecklistStatus } = store.getState().courseChecklist.loadingStatus;

Expand All @@ -138,7 +138,7 @@ describe('CourseChecklistPage', () => {

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

Expand Down
4 changes: 3 additions & 1 deletion src/course-unit/CourseUnit.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,9 @@ describe('<CourseUnit />', () => {
});
render(<RootWrapper />);
// to wait for loading
screen.findByTestId('unit-header-title');
await waitFor(() => {
screen.getAllByTestId('unit-header-title').toHaveLength(1);
});
// The new unit button should not be visible when childAddable is false
expect(
screen.queryByRole('button', { name: courseSequenceMessages.newUnitBtnText.defaultMessage }),
Expand Down
4 changes: 2 additions & 2 deletions src/library-authoring/hierarchy/ItemHierarchyPublisher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ export const ItemHierarchyPublisher = ({
{intl.formatMessage(messages.publishCancel)}
</Button>
<LoadingButton
onClick={async (e) => {
onClick={(e) => {
e.preventDefault();
e.stopPropagation();
await handlePublish();
handlePublish();
}}
variant="primary rounded-0"
label={intl.formatMessage(messages.publishConfirm)}
Expand Down
4 changes: 4 additions & 0 deletions src/optimizer-page/scan-results/ScanResults.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ const ScanResults: FC<Props> = ({
const handleUpdateCompletion = async () => {
if (rerunLinkUpdateInProgress === false && isUpdateAllInProgress) {
try {
// oxlint-disable-next-line @typescript-eslint/await-thenable - this IS a promise; it just has wrong type info
const updateStatusResponse = await dispatch(fetchRerunLinkUpdateStatus(courseId)) as any;

if (!updateStatusResponse) {
Expand Down Expand Up @@ -590,13 +591,15 @@ const ScanResults: FC<Props> = ({
try {
setUpdatingLinkIds(prev => ({ ...prev, [uniqueId]: true }));
const contentType = getContentType(sectionId || '');
// oxlint-disable-next-line @typescript-eslint/await-thenable - this IS a promise; it just has wrong type info.
await dispatch(updateSinglePreviousRunLink(courseId, link, blockId, contentType));

const pollForSingleLinkResult = async (attempts = 0): Promise<boolean> => {
if (attempts > 30) { // Max 30 attempts (60 seconds)
throw new Error('Timeout waiting for link update result');
}

// oxlint-disable-next-line @typescript-eslint/await-thenable - this IS a promise; it just has wrong type info.
const updateStatusResponse = await dispatch(fetchRerunLinkUpdateStatus(courseId)) as any;
const pollStatus = updateStatusResponse?.status || updateStatusResponse?.updateStatus;

Expand Down Expand Up @@ -755,6 +758,7 @@ const ScanResults: FC<Props> = ({
try {
setProcessedResponseIds(new Set());
setIsUpdateAllInProgress(true);
// oxlint-disable-next-line @typescript-eslint/await-thenable - this IS a promise; it just has wrong type info.
await dispatch(updateAllPreviousRunLinks(courseId));

return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,21 +72,22 @@ const AppSettingsModal = ({
const handleFormSubmit = async (values) => {
let success = true;
if (appInfo.enabled !== values.enabled) {
// oxlint-disable-next-line @typescript-eslint/await-thenable - this IS a promise; it just has wrong type info.
success = await dispatch(updateAppStatus(courseId, appInfo.id, values.enabled));
}
// Call the submit handler for the settings component to save its settings
if (onSettingsSave) {
success = success && await onSettingsSave(values);
}
await setSaveError(!success);
setSaveError(!success);
!success && alertRef?.current.scrollIntoView(); // eslint-disable-line @typescript-eslint/no-unused-expressions
};

const handleFormikSubmit = ({ handleSubmit, errors }) => async (event) => {
// If submitting the form with errors, show the alert and scroll to it.
await handleSubmit(event);
if (Object.keys(errors).length > 0) {
await setSaveError(true);
setSaveError(true);
alertRef?.current.scrollIntoView?.(); // eslint-disable-line no-unused-expressions
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/taxonomy/TaxonomyListPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ describe('<TaxonomyListPage />', () => {
} = render(<TaxonomyListPage />);

// Open the taxonomies org filter select menu
const taxonomiesFilterSelectMenu = await getByRole('button', { name: 'All taxonomies' });
const taxonomiesFilterSelectMenu = getByRole('button', { name: 'All taxonomies' });
fireEvent.click(taxonomiesFilterSelectMenu);

// Check that the 'Unassigned' option is correctly called
Expand Down
Loading