diff --git a/src/components/CodeSearchResults/CodeSearchResults.test.jsx b/src/components/CodeSearchResults/CodeSearchResults.test.jsx index be04bd8b12..aae70500a8 100644 --- a/src/components/CodeSearchResults/CodeSearchResults.test.jsx +++ b/src/components/CodeSearchResults/CodeSearchResults.test.jsx @@ -5,6 +5,7 @@ import { MemoryRouter } from 'react-router-dom'; import { mount } from 'enzyme'; import configureMockStore from 'redux-mock-store'; import thunk from 'redux-thunk'; +import { IntlProvider } from '@edx/frontend-platform/i18n'; import CodeSearchResults from './index'; @@ -77,12 +78,14 @@ describe('', () => { .create(( - + + + )) @@ -105,11 +108,13 @@ describe('', () => { .create(( - + + + )) @@ -164,11 +169,13 @@ describe('', () => { .create(( - + + + )) @@ -204,11 +211,13 @@ describe('', () => { .create(( - + + + )) @@ -235,11 +244,13 @@ describe('', () => { .create(( - + + + )) @@ -262,11 +273,13 @@ describe('', () => { .create(( - + + + )) @@ -305,11 +318,13 @@ describe('', () => { const wrapper = mount(( - + + + )); @@ -360,11 +375,13 @@ describe('', () => { const wrapper = mount(( - + + + )); @@ -405,11 +422,13 @@ describe('', () => { const wrapper = mount(( - + + + )); @@ -441,11 +460,13 @@ describe('', () => { const wrapper = mount(( - + + + )); diff --git a/src/components/CodeSearchResults/__snapshots__/CodeSearchResults.test.jsx.snap b/src/components/CodeSearchResults/__snapshots__/CodeSearchResults.test.jsx.snap index 22037c135e..d941e19603 100644 --- a/src/components/CodeSearchResults/__snapshots__/CodeSearchResults.test.jsx.snap +++ b/src/components/CodeSearchResults/__snapshots__/CodeSearchResults.test.jsx.snap @@ -611,11 +611,7 @@ exports[` basic rendering should render table data 1`] = `
- Showing - 4 - of - 0 - . + Showing 4 of 0.
basic rendering should render table data when sea
- Showing - 1 - of - 0 - . + Showing 1 of 0.
( - + + + ); diff --git a/src/components/EnrolledLearnersForInactiveCoursesTable/EnrolledLearnersForInactiveCoursesTable.test.jsx b/src/components/EnrolledLearnersForInactiveCoursesTable/EnrolledLearnersForInactiveCoursesTable.test.jsx index cb8eb07fd2..a103502b17 100644 --- a/src/components/EnrolledLearnersForInactiveCoursesTable/EnrolledLearnersForInactiveCoursesTable.test.jsx +++ b/src/components/EnrolledLearnersForInactiveCoursesTable/EnrolledLearnersForInactiveCoursesTable.test.jsx @@ -5,6 +5,7 @@ import configureMockStore from 'redux-mock-store'; import thunk from 'redux-thunk'; import { Provider } from 'react-redux'; import { mount } from 'enzyme'; +import { IntlProvider } from '@edx/frontend-platform/i18n'; import EnrolledLearnersForInactiveCoursesTable from '.'; @@ -95,9 +96,11 @@ const enrolledLearnersForInactiveCoursesStore = mockStore({ const EnrolledLearnersForInactiveCoursesEmptyTableWrapper = props => ( - + + + ); @@ -105,9 +108,11 @@ const EnrolledLearnersForInactiveCoursesEmptyTableWrapper = props => ( const EnrolledLearnersForInactiveCoursesWrapper = props => ( - + + + ); diff --git a/src/components/EnrolledLearnersForInactiveCoursesTable/__snapshots__/EnrolledLearnersForInactiveCoursesTable.test.jsx.snap b/src/components/EnrolledLearnersForInactiveCoursesTable/__snapshots__/EnrolledLearnersForInactiveCoursesTable.test.jsx.snap index d6f6328caf..8752287883 100644 --- a/src/components/EnrolledLearnersForInactiveCoursesTable/__snapshots__/EnrolledLearnersForInactiveCoursesTable.test.jsx.snap +++ b/src/components/EnrolledLearnersForInactiveCoursesTable/__snapshots__/EnrolledLearnersForInactiveCoursesTable.test.jsx.snap @@ -74,11 +74,7 @@ exports[`EnrolledLearnersForInactiveCoursesTable renders enrolled learners for i
- Showing - 3 - of - 3 - . + Showing 3 of 3.
', () => { expect(screen.getByText('/admin/coupons/request-codes')).toBeInTheDocument(); }); it('should enable code reporting screen', () => { - render(); + render(); expect(screen.getByText('/admin/reporting')).toBeInTheDocument(); }); it('should enable code subscriptions screen', () => { diff --git a/src/components/LearnerActivityTable/LearnerActivityTable.test.jsx b/src/components/LearnerActivityTable/LearnerActivityTable.test.jsx index 4b4c0ea2be..2db1783b4f 100644 --- a/src/components/LearnerActivityTable/LearnerActivityTable.test.jsx +++ b/src/components/LearnerActivityTable/LearnerActivityTable.test.jsx @@ -5,6 +5,7 @@ import configureMockStore from 'redux-mock-store'; import thunk from 'redux-thunk'; import { Provider } from 'react-redux'; import { mount } from 'enzyme'; +import { IntlProvider } from '@edx/frontend-platform/i18n'; import LearnerActivityTable from '.'; @@ -84,9 +85,11 @@ const learnerActivityStore = mockStore({ const LearnerActivityEmptyTableWrapper = props => ( - + + + ); @@ -94,9 +97,11 @@ const LearnerActivityEmptyTableWrapper = props => ( const LearnerActivityTableWrapper = props => ( - + + + ); diff --git a/src/components/LearnerActivityTable/__snapshots__/LearnerActivityTable.test.jsx.snap b/src/components/LearnerActivityTable/__snapshots__/LearnerActivityTable.test.jsx.snap index 63d83b2c41..cfd71116ad 100644 --- a/src/components/LearnerActivityTable/__snapshots__/LearnerActivityTable.test.jsx.snap +++ b/src/components/LearnerActivityTable/__snapshots__/LearnerActivityTable.test.jsx.snap @@ -34,11 +34,7 @@ exports[`LearnerActivityTable renders active learners table correctly 1`] = `
- Showing - 2 - of - 2 - . + Showing 2 of 2.
- Showing - 2 - of - 2 - . + Showing 2 of 2.
- Showing - 2 - of - 2 - . + Showing 2 of 2.
({ })); const enterpriseId = 'test-enterprise'; +const mockStore = configureMockStore([thunk]); +const store = mockStore({}); + +const CornerstoneIntegrationConfigFormWrapper = props => ( + + + + + + + +); describe('', () => { test('renders Cornerstone Config Form', () => { - render(); + render(); // Verify all expected fields are present. screen.getByLabelText('Active'); screen.getByLabelText('Cornerstone Instance URL'); @@ -27,13 +45,13 @@ describe('', () => { active: true, cornerstoneBaseUrl: 'initial_url', }; - render(); + render(); expect(screen.getByLabelText('Active')).toBeChecked(); expect(screen.getByLabelText('Cornerstone Instance URL')).toHaveValue('initial_url'); }); test('required fields show as invalid when not filled in', () => { - render(); + render(); fireEvent.click(screen.getByText('Submit')); expect(screen.getByLabelText('Cornerstone Instance URL')).toHaveClass('is-invalid'); @@ -49,7 +67,7 @@ describe('', () => { enterprise_customer: enterpriseId, }; - render(); + render(); fireEvent.change(screen.getByLabelText('Cornerstone Instance URL'), { target: { value: 'testinstance' }, }); @@ -66,7 +84,7 @@ describe('', () => { cornerstoneBaseUrl: 'testinstance', }; - render(); + render(); fireEvent.change(screen.getByLabelText('Cornerstone Instance URL'), { target: { value: 'changedURL' }, }); diff --git a/src/components/LmsConfigurations/DegreedIntegrationConfigForm.test.jsx b/src/components/LmsConfigurations/DegreedIntegrationConfigForm.test.jsx index 19659d15df..beb4f26ff4 100644 --- a/src/components/LmsConfigurations/DegreedIntegrationConfigForm.test.jsx +++ b/src/components/LmsConfigurations/DegreedIntegrationConfigForm.test.jsx @@ -4,6 +4,12 @@ import { import '@testing-library/jest-dom/extend-expect'; import React from 'react'; import snakeCase from 'lodash/snakeCase'; +import { IntlProvider } from '@edx/frontend-platform/i18n'; +import { MemoryRouter } from 'react-router-dom'; +import { Provider } from 'react-redux'; +import configureMockStore from 'redux-mock-store'; +import thunk from 'redux-thunk'; + import DegreedIntegrationConfigForm from './DegreedIntegrationConfigForm'; import LmsApiService from '../../data/services/LmsApiService'; @@ -13,10 +19,22 @@ jest.mock('../../data/services/LmsApiService', () => ({ })); const enterpriseId = 'test-enterprise'; +const mockStore = configureMockStore([thunk]); +const store = mockStore({}); + +const DegreedIntegrationConfigFormWrapper = props => ( + + + + + + + +); describe('', () => { test('renders Degreed Config Form', () => { - render(); + render(); // Verify all expected fields are present. screen.getByLabelText('Active'); screen.getByLabelText('Degreed User ID'); @@ -37,7 +55,7 @@ describe('', () => { key: 'initial_key', secret: 'initial_secret', }; - render(); + render(); expect(screen.getByLabelText('Active')).toBeChecked(); expect(screen.getByLabelText('Degreed User ID')).toHaveValue('initial_id'); expect(screen.getByLabelText('Degreed User Password')).toHaveValue('initial_pass'); @@ -48,7 +66,7 @@ describe('', () => { }); test('required fields show as invalid when not filled in', () => { - render(); + render(); fireEvent.click(screen.getByText('Submit')); expect(screen.getByLabelText('Degreed User ID')).toHaveClass('is-invalid'); @@ -74,7 +92,7 @@ describe('', () => { enterprise_customer: enterpriseId, }; - render(); + render(); fireEvent.change(screen.getByLabelText('Degreed User ID'), { target: { value: 'testuserid' }, }); @@ -111,7 +129,7 @@ describe('', () => { secret: 'testsecret', }; - render(); + render(); fireEvent.change(screen.getByLabelText('Degreed User ID'), { target: { value: 'changedUserId' }, }); diff --git a/src/components/PastWeekPassedLearnersTable/PastWeekPassedLearnersTable.test.jsx b/src/components/PastWeekPassedLearnersTable/PastWeekPassedLearnersTable.test.jsx index a4590b162f..9b88dba991 100644 --- a/src/components/PastWeekPassedLearnersTable/PastWeekPassedLearnersTable.test.jsx +++ b/src/components/PastWeekPassedLearnersTable/PastWeekPassedLearnersTable.test.jsx @@ -5,6 +5,7 @@ import configureMockStore from 'redux-mock-store'; import thunk from 'redux-thunk'; import { Provider } from 'react-redux'; import { mount } from 'enzyme'; +import { IntlProvider } from '@edx/frontend-platform/i18n'; import PastWeekPassedLearnersTable from '.'; @@ -51,9 +52,11 @@ const store = mockStore({ const PastWeekPassedLearnersWrapper = props => ( - + + + ); diff --git a/src/components/PastWeekPassedLearnersTable/__snapshots__/PastWeekPassedLearnersTable.test.jsx.snap b/src/components/PastWeekPassedLearnersTable/__snapshots__/PastWeekPassedLearnersTable.test.jsx.snap index d4b75b2bc7..44a1bfacac 100644 --- a/src/components/PastWeekPassedLearnersTable/__snapshots__/PastWeekPassedLearnersTable.test.jsx.snap +++ b/src/components/PastWeekPassedLearnersTable/__snapshots__/PastWeekPassedLearnersTable.test.jsx.snap @@ -34,11 +34,7 @@ exports[`PastWeekPassedLearnersTable renders table correctly 1`] = `
- Showing - 2 - of - 2 - . + Showing 2 of 2.
- Showing - 3 - of - 24 - . + Showing 3 of 24.
- Showing - 3 - of - 24 - . + Showing 3 of 24.
( - + + + ); @@ -507,7 +510,7 @@ describe('CouponDetails container', () => { const statusAlert = wrapper.find(Alert); expect(statusAlert.prop('variant')).toEqual('success'); expect(statusAlert.text()).toContain(SUCCESS_MESSAGES.assign); - statusAlert.find({ children: 'Dismiss' }).simulate('click'); + statusAlert.find('.btn-tertiary').simulate('click'); // after alert is dismissed expect(wrapper.find(Alert)).toHaveLength(0);