diff --git a/.eslintrc.js b/.eslintrc.js index 4cbd4e50..b47d9043 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -13,6 +13,7 @@ module.exports = createConfig('eslint', { rules: { 'react/function-component-definition': 'off', 'import/prefer-default-export': 'off', + 'import/no-extraneous-dependencies': 'off', }, overrides: [ { diff --git a/plugins/communications-app/CheckBoxForm/index.jsx b/plugins/communications-app/CheckBoxForm/index.jsx index 7c73a7ea..2ff8087c 100644 --- a/plugins/communications-app/CheckBoxForm/index.jsx +++ b/plugins/communications-app/CheckBoxForm/index.jsx @@ -9,9 +9,13 @@ const CheckBoxForm = ({ isChecked, handleChange, label }) => ( ); +CheckBoxForm.defaultProps = { + handleChange: () => {}, +}; + CheckBoxForm.propTypes = { isChecked: PropTypes.bool.isRequired, - handleChange: PropTypes.func.isRequired, + handleChange: PropTypes.func, label: PropTypes.string.isRequired, }; diff --git a/src/components/PluggableComponent/__snapshots__/index.test.jsx.snap b/src/components/PluggableComponent/__snapshots__/index.test.jsx.snap index e902e0b5..7fe3693e 100644 --- a/src/components/PluggableComponent/__snapshots__/index.test.jsx.snap +++ b/src/components/PluggableComponent/__snapshots__/index.test.jsx.snap @@ -3,22 +3,31 @@ exports[`PluggableComponent renders correctly 1`] = `
- +
+ +
+

+ @openedx-plugins/communications-app-input-form +

null} + isChecked >

Checkbox -default

@@ -292,7 +292,7 @@ function BulkEmailForm(props) {

Input -default

{/* this will return default child if the plugin has not been installed */} - + () => null); const appendMock = jest.spyOn(FormData.prototype, 'append'); const dispatchMock = jest.fn(); diff --git a/src/components/bulk-email-tool/test/BulkEmailTool.test.jsx b/src/components/bulk-email-tool/test/BulkEmailTool.test.jsx index 9ea6c9b5..d9c06fc3 100644 --- a/src/components/bulk-email-tool/test/BulkEmailTool.test.jsx +++ b/src/components/bulk-email-tool/test/BulkEmailTool.test.jsx @@ -5,7 +5,7 @@ import React from 'react'; import { Factory } from 'rosie'; import { camelCaseObject } from '@edx/frontend-platform'; import { - render, screen, cleanup, initializeMockApp, + render, screen, cleanup, initializeMockApp, act, } from '../../../setupTest'; import BulkEmailTool from '../BulkEmailTool'; import { CourseMetadataContext } from '../../page-container/PageContainer'; @@ -67,14 +67,16 @@ describe('BulkEmailTool', () => { const cohorts = { cohorts: [] }; const courseInfo = Factory.build('courseMetadata'); const courseMetadata = buildCourseMetadata(cohorts, courseInfo); - renderBulkEmailTool(courseMetadata); - // verify all tab data expected is displayed within our component - expect(await screen.findByText('Course')).toBeTruthy(); - expect(await screen.findByText('Discussion')).toBeTruthy(); - expect(await screen.findByText('Wiki')).toBeTruthy(); - expect(await screen.findByText('Progress')).toBeTruthy(); - expect(await screen.findByText('Instructor')).toBeTruthy(); - expect(await screen.findByText('Dates')).toBeTruthy(); + await act(async () => { + renderBulkEmailTool(courseMetadata); + // verify all tab data expected is displayed within our component + expect(screen.findByText('Course')).toBeTruthy(); + expect(screen.findByText('Discussion')).toBeTruthy(); + expect(screen.findByText('Wiki')).toBeTruthy(); + expect(screen.findByText('Progress')).toBeTruthy(); + expect(screen.findByText('Instructor')).toBeTruthy(); + expect(screen.findByText('Dates')).toBeTruthy(); + }); }); test('BulkEmailTool renders error page on no staff user', async () => {