fix: test failures

This commit is contained in:
Irtaza Akram
2026-01-07 16:36:14 +05:00
committed by Feanil Patel
parent 2e836a55cf
commit 10705bc921
4 changed files with 11 additions and 5 deletions

View File

@@ -51,7 +51,12 @@ const ScoringCard = ({
return (
<SettingsOption
title={intl.formatMessage(messages.scoringSettingsTitle)}
summary={getScoringSummary(scoring.weight, scoring.attempts.number, scoring.attempts.unlimited, scoring.gradingMethod)}
summary={getScoringSummary(
scoring.weight,
scoring.attempts.number,
scoring.attempts.unlimited,
scoring.gradingMethod,
)}
className="scoringCard"
>
<div className="mb-4">

View File

@@ -67,7 +67,7 @@ describe('ScoringCard', () => {
const gradingSelect = screen.getByRole('combobox', { name: 'Grading method' });
expect(gradingSelect).toBeInTheDocument();
expect(gradingSelect.value).toBe(GradingMethodKeys.LAST_SCORE);
fireEvent.change(gradingSelect, { target: { value: GradingMethodKeys.HIGHEST_SCORE } });
expect(props.updateSettings).toHaveBeenCalled();
});

View File

@@ -9,7 +9,7 @@ import * as video from './video';
import * as problem from './problem';
import * as game from './game';
import type { RequestKeys, RequestStates } from '../constants/requests';
import { AdvancedProblemType, ProblemType } from '../constants/problem';
import { AdvancedProblemType, GradingMethodKeys, ProblemType } from '../constants/problem';
export { default as thunkActions } from './thunkActions';
@@ -175,7 +175,8 @@ export interface EditorState {
randomization: null | any; // Not sure what type this field has
scoring: {
weight: number;
attempts: { unlimited: boolean; number: number | null; }
attempts: { unlimited: boolean; number: number | null; };
gradingMethod: GradingMethodKeys.LAST_SCORE;
},
hints: any[];
timeBetween: number;

View File

@@ -29,7 +29,7 @@ const initialState: EditorState['problem'] = {
unlimited: true,
number: null,
},
gradingMethod: GradingMethodKeys.LAST_SCORE
gradingMethod: GradingMethodKeys.LAST_SCORE,
},
hints: [],
timeBetween: 0,