diff --git a/src/components/SidePanes/CatalogInclusionPane.jsx b/src/components/SidePanes/CatalogInclusionPane.jsx
index f3bf8a096..dbb3dcc0c 100644
--- a/src/components/SidePanes/CatalogInclusionPane.jsx
+++ b/src/components/SidePanes/CatalogInclusionPane.jsx
@@ -1,7 +1,7 @@
import React, { useState } from 'react';
import PropTypes from 'prop-types';
import { Form, Spinner } from '@edx/paragon';
-import { PUBLISHED, UNPUBLISHED } from '../../data/constants';
+import { PUBLISHED, REVIEWED, UNPUBLISHED } from '../../data/constants';
import DiscoveryDataApiService from '../../data/services/DiscoveryDataApiService';
import Pane from './Pane';
@@ -24,7 +24,7 @@ const CatalogInclusionPane = ({
e.preventDefault();
setIsLoading(true);
let draft = null;
- if (draftStatuses.includes(PUBLISHED)) {
+ if (draftStatuses.includes(PUBLISHED) || draftStatuses.includes(REVIEWED)) {
draft = false;
} else if (draftStatuses.includes(UNPUBLISHED)) {
draft = true;
@@ -47,7 +47,7 @@ const CatalogInclusionPane = ({
setError(null);
setIsLoading(false);
} catch (err) {
- const errorText = `Unable to toggle attribute, recieved error: ${err.response.status} ${err.response.statusText}`;
+ const errorText = `Unable to toggle attribute, received error: ${err.response.status} ${err.response.statusText}`;
setIsLoading(false);
setError(errorText);
}
diff --git a/src/components/SidePanes/CatalogInclusionPane.test.jsx b/src/components/SidePanes/CatalogInclusionPane.test.jsx
index 1a7208a8c..46d6f0f5c 100644
--- a/src/components/SidePanes/CatalogInclusionPane.test.jsx
+++ b/src/components/SidePanes/CatalogInclusionPane.test.jsx
@@ -2,31 +2,61 @@ import React from 'react';
import { mount } from 'enzyme';
import CatalogInclusionPane from './CatalogInclusionPane';
+import DiscoveryDataApiService from '../../data/services/DiscoveryDataApiService';
describe('CatalogInclusionPane', () => {
const mockUuid = 'test-enterprise-id';
- const mockInclusion = false;
+ const mockSubInclusion = false;
+ const mockOrgInclusion = true;
+ const spy = jest.spyOn(DiscoveryDataApiService, 'editCourse');
it('correct toggle behavior', () => {
const wrapper = mount();
wrapper.find(CatalogInclusionPane);
const title = wrapper.find('Enterprise Subscriptions');
expect(title);
const toggle = wrapper.find('.pgn__form-switch-input');
toggle.simulate('change', { target: { checked: false } });
- expect(toggle.props().checked).toBe(false);
+ expect(spy).toBeCalledWith(
+ {
+ draft: false,
+ enterprise_subscription_inclusion: !mockSubInclusion,
+ uuid: 'test-enterprise-id',
+ },
+ );
});
+ it('allow course runs who have been reviewed', () => {
+ const wrapper = mount();
+ wrapper.find(CatalogInclusionPane);
+ const title = wrapper.find('Enterprise Subscriptions');
+ expect(title);
+ const toggle = wrapper.find('.pgn__form-switch-input');
+ toggle.simulate('change', { target: { checked: false } });
+ expect(spy).toBeCalledWith(
+ {
+ draft: false,
+ enterprise_subscription_inclusion: !mockSubInclusion,
+ uuid: 'test-enterprise-id',
+ },
+ );
+ });
it('toggle disabled when org is false', () => {
const wrapper = mount();
// org not included helper text
expect(wrapper.find('.text-gray-300')).toHaveLength(1);
@@ -34,9 +64,9 @@ describe('CatalogInclusionPane', () => {
it('toggle blocked in review status', () => {
const wrapper = mount();
const toggle = wrapper.find('.pgn__form-switch-input');
toggle.simulate('change', { target: { checked: false } });