From 2716b5f89d2cc8d3409508eae2912b9ade3d891f Mon Sep 17 00:00:00 2001 From: Bryann Valderrama Date: Wed, 10 Apr 2024 08:00:02 -0500 Subject: [PATCH] test: add env variable to setup test --- .../settingsComponents/ScoringCard.jsx | 2 +- .../settingsComponents/ScoringCard.test.jsx | 5 + .../__snapshots__/ScoringCard.test.jsx.snap | 144 ++++++++++++++++-- 3 files changed, 138 insertions(+), 13 deletions(-) diff --git a/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/ScoringCard.jsx b/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/ScoringCard.jsx index abe4b28bf..53f0e9722 100644 --- a/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/ScoringCard.jsx +++ b/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/ScoringCard.jsx @@ -22,7 +22,7 @@ export const ScoringCard = ({ learningContextId, isLibrary, }) => { - const isGradingMethodEnabled = getConfig().ENABLE_GRADING_METHOD_IN_PROBLEMS || false; + const isGradingMethodEnabled = getConfig().ENABLE_GRADING_METHOD_IN_PROBLEMS; const { handleUnlimitedChange, handleMaxAttemptChange, diff --git a/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/ScoringCard.test.jsx b/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/ScoringCard.test.jsx index 339480964..38e43cec7 100644 --- a/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/ScoringCard.test.jsx +++ b/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/ScoringCard.test.jsx @@ -1,10 +1,15 @@ import React from 'react'; import { shallow } from '@edx/react-unit-test-utils'; +import { mergeConfig } from '@edx/frontend-platform'; import { formatMessage } from '../../../../../../../testUtils'; import { scoringCardHooks } from '../hooks'; import { ScoringCard } from './ScoringCard'; import { GradingMethodKeys } from '../../../../../../data/constants/problem'; +mergeConfig({ + ENABLE_GRADING_METHOD_IN_PROBLEMS: true, +}); + jest.mock('../hooks', () => ({ scoringCardHooks: jest.fn(), })); diff --git a/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/__snapshots__/ScoringCard.test.jsx.snap b/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/__snapshots__/ScoringCard.test.jsx.snap index 59a32a66e..41c40704d 100644 --- a/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/__snapshots__/ScoringCard.test.jsx.snap +++ b/src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/__snapshots__/ScoringCard.test.jsx.snap @@ -5,18 +5,58 @@ exports[`ScoringCard snapshot snapshot: scoring setting card 1`] = ` className="scoringCard" extraSections={Array []} hasExpandableTextArea={false} - summary="{weight, plural, =0 {Ungraded} other {# points}} · {attempts, plural, =1 {# attempt} other {# attempts}}" + summary="{weight, plural, =0 {Ungraded} other {# points}} · {attempts, plural, =1 {# attempt} other {# attempts}} · Last Score" title="Scoring" >
+ + + + + + + + + + +
+ + + + + + + + + + +
+ + + + + + + + + + +