From 71fa247c611dd819cfcd19c989122a126929b54f Mon Sep 17 00:00:00 2001 From: jacobo-dominguez-wgu Date: Tue, 24 Jun 2025 04:04:03 -0600 Subject: [PATCH] test: replacing snapshot tests with RTL tests part 11 (#2214) --- .../components/Feedback/FeedbackBox.test.jsx | 31 ---- .../components/Feedback/FeedbackBox.test.tsx | 49 ++++++ .../__snapshots__/FeedbackBox.test.jsx.snap | 154 ------------------ .../SettingsWidget/CardSection.test.jsx | 15 -- .../SettingsWidget/CardSection.test.tsx | 23 +++ .../__snapshots__/CardSection.test.jsx.snap | 34 ---- .../SwitchEditorCard.test.jsx | 30 ---- .../SwitchEditorCard.test.tsx | 58 +++++++ .../SwitchEditorCard.test.jsx.snap | 44 ----- .../__snapshots__/index.test.jsx.snap | 64 -------- .../components/DurationWidget/index.test.jsx | 52 ------ .../components/DurationWidget/index.test.tsx | 47 ++++++ .../__snapshots__/index.test.jsx.snap | 36 ---- .../{index.test.jsx => index.test.tsx} | 13 +- 14 files changed, 185 insertions(+), 465 deletions(-) delete mode 100644 src/editors/containers/ProblemEditor/components/EditProblemView/AnswerWidget/components/Feedback/FeedbackBox.test.jsx create mode 100644 src/editors/containers/ProblemEditor/components/EditProblemView/AnswerWidget/components/Feedback/FeedbackBox.test.tsx delete mode 100644 src/editors/containers/ProblemEditor/components/EditProblemView/AnswerWidget/components/Feedback/__snapshots__/FeedbackBox.test.jsx.snap delete mode 100644 src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/CardSection.test.jsx create mode 100644 src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/CardSection.test.tsx delete mode 100644 src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/__snapshots__/CardSection.test.jsx.snap delete mode 100644 src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/SwitchEditorCard.test.jsx create mode 100644 src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/SwitchEditorCard.test.tsx delete mode 100644 src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/__snapshots__/SwitchEditorCard.test.jsx.snap delete mode 100644 src/editors/containers/VideoEditor/components/VideoSettingsModal/components/DurationWidget/__snapshots__/index.test.jsx.snap delete mode 100644 src/editors/containers/VideoEditor/components/VideoSettingsModal/components/DurationWidget/index.test.jsx create mode 100644 src/editors/containers/VideoEditor/components/VideoSettingsModal/components/DurationWidget/index.test.tsx delete mode 100644 src/plugin-slots/CourseUnitHeaderActionsSlot/__snapshots__/index.test.jsx.snap rename src/plugin-slots/CourseUnitHeaderActionsSlot/{index.test.jsx => index.test.tsx} (73%) diff --git a/src/editors/containers/ProblemEditor/components/EditProblemView/AnswerWidget/components/Feedback/FeedbackBox.test.jsx b/src/editors/containers/ProblemEditor/components/EditProblemView/AnswerWidget/components/Feedback/FeedbackBox.test.jsx deleted file mode 100644 index 2c1fa2dd5..000000000 --- a/src/editors/containers/ProblemEditor/components/EditProblemView/AnswerWidget/components/Feedback/FeedbackBox.test.jsx +++ /dev/null @@ -1,31 +0,0 @@ -import { shallow } from '@edx/react-unit-test-utils'; -import { FeedbackBox } from './FeedbackBox'; - -const answerWithFeedback = { - id: 'A', - title: 'Answer 1', - correct: true, - selectedFeedback: 'some feedback', - unselectedFeedback: 'unselectedFeedback', - problemType: 'sOMepRObleM', - images: {}, - isLibrary: false, - learningContextId: 'course+org+run', -}; - -const props = { - answer: answerWithFeedback, - intl: {}, -}; - -describe('FeedbackBox component', () => { - test('renders as expected with default props', () => { - expect(shallow().snapshot).toMatchSnapshot(); - }); - test('renders as expected with a numeric input problem', () => { - expect(shallow().snapshot).toMatchSnapshot(); - }); - test('renders as expected with a multi select problem', () => { - expect(shallow().snapshot).toMatchSnapshot(); - }); -}); diff --git a/src/editors/containers/ProblemEditor/components/EditProblemView/AnswerWidget/components/Feedback/FeedbackBox.test.tsx b/src/editors/containers/ProblemEditor/components/EditProblemView/AnswerWidget/components/Feedback/FeedbackBox.test.tsx new file mode 100644 index 000000000..7e2f21e76 --- /dev/null +++ b/src/editors/containers/ProblemEditor/components/EditProblemView/AnswerWidget/components/Feedback/FeedbackBox.test.tsx @@ -0,0 +1,49 @@ +import { render, screen, initializeMocks } from '@src/testUtils'; +import { FeedbackBox } from './FeedbackBox'; + +jest.mock('../../../../../../../sharedComponents/ExpandableTextArea', () => jest.fn(({ + id, value, setContent, placeholder, +}) => ( +