Skip to content

Commit

Permalink
fix: add default value when destructuring collaborator options (#966)
Browse files Browse the repository at this point in the history
fix: add default value when destructuring collaborator options
  • Loading branch information
zawan-ila authored Aug 2, 2024
1 parent ec03354 commit b4d2b85
Show file tree
Hide file tree
Showing 3 changed files with 1,406 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/EditCoursePage/EditCourseForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ export class BaseEditCourseForm extends React.Component {

const {
data: {
results: allResults,
results: allResults = [],
},
} = collaboratorOptions;

Expand Down
20 changes: 20 additions & 0 deletions src/components/EditCoursePage/EditCourseForm.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -474,4 +474,24 @@ describe('BaseEditCourseForm', () => {
const fields = component.find({ name: 'imageSrc' });
expect(fields).toHaveLength(1);
});

it('renders html correctly while fetching collaborator options', () => {
const component = shallow(<BaseEditCourseForm
handleSubmit={() => null}
initialValues={{
title: initialValuesFull.title,
}}
title={initialValuesFull.title}
number="Test101x"
courseStatuses={[UNPUBLISHED]}
courseInfo={courseInfo}
courseOptions={courseOptions}
courseRunOptions={courseRunOptions}
uuid={initialValuesFull.uuid}
type={initialValuesFull.type}
id="edit-course-form"
collaboratorOptions={{ data: {} }}
/>);
expect(shallowToJson(component)).toMatchSnapshot();
});
});
Loading

0 comments on commit b4d2b85

Please sign in to comment.