Skip to content

Commit

Permalink
fix: failed unit tests after backmerging from master
Browse files Browse the repository at this point in the history
  • Loading branch information
abdullahwaheed committed Jul 1, 2022
1 parent 4d6890c commit dc04679
Show file tree
Hide file tree
Showing 14 changed files with 171 additions and 130 deletions.
123 changes: 72 additions & 51 deletions src/components/CodeSearchResults/CodeSearchResults.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -77,12 +78,14 @@ describe('<CodeSearchResults />', () => {
.create((
<MemoryRouter>
<Provider store={store}>
<CodeSearchResults
onClose={jest.fn()}
searchQuery="[email protected]"
enableLearnerPortal={false}
enterpriseSlug="sluggy"
/>
<IntlProvider locale="en">
<CodeSearchResults
onClose={jest.fn()}
searchQuery="[email protected]"
enableLearnerPortal={false}
enterpriseSlug="sluggy"
/>
</IntlProvider>
</Provider>
</MemoryRouter>
))
Expand All @@ -105,11 +108,13 @@ describe('<CodeSearchResults />', () => {
.create((
<MemoryRouter>
<Provider store={store}>
<CodeSearchResults
onClose={jest.fn()}
searchQuery="[email protected]"
isOpen
/>
<IntlProvider locale="en">
<CodeSearchResults
onClose={jest.fn()}
searchQuery="[email protected]"
isOpen
/>
</IntlProvider>
</Provider>
</MemoryRouter>
))
Expand Down Expand Up @@ -164,11 +169,13 @@ describe('<CodeSearchResults />', () => {
.create((
<MemoryRouter>
<Provider store={store}>
<CodeSearchResults
onClose={jest.fn()}
searchQuery="[email protected]"
isOpen
/>
<IntlProvider locale="en">
<CodeSearchResults
onClose={jest.fn()}
searchQuery="[email protected]"
isOpen
/>
</IntlProvider>
</Provider>
</MemoryRouter>
))
Expand Down Expand Up @@ -204,11 +211,13 @@ describe('<CodeSearchResults />', () => {
.create((
<MemoryRouter>
<Provider store={store}>
<CodeSearchResults
onClose={jest.fn()}
searchQuery="FAG2LVLNHAKIXQ0Q"
isOpen
/>
<IntlProvider locale="en">
<CodeSearchResults
onClose={jest.fn()}
searchQuery="FAG2LVLNHAKIXQ0Q"
isOpen
/>
</IntlProvider>
</Provider>
</MemoryRouter>
))
Expand All @@ -235,11 +244,13 @@ describe('<CodeSearchResults />', () => {
.create((
<MemoryRouter>
<Provider store={store}>
<CodeSearchResults
onClose={jest.fn()}
searchQuery="[email protected]"
isOpen
/>
<IntlProvider locale="en">
<CodeSearchResults
onClose={jest.fn()}
searchQuery="[email protected]"
isOpen
/>
</IntlProvider>
</Provider>
</MemoryRouter>
))
Expand All @@ -262,11 +273,13 @@ describe('<CodeSearchResults />', () => {
.create((
<MemoryRouter>
<Provider store={store}>
<CodeSearchResults
onClose={jest.fn()}
searchQuery="[email protected]"
isOpen
/>
<IntlProvider locale="en">
<CodeSearchResults
onClose={jest.fn()}
searchQuery="[email protected]"
isOpen
/>
</IntlProvider>
</Provider>
</MemoryRouter>
))
Expand Down Expand Up @@ -305,11 +318,13 @@ describe('<CodeSearchResults />', () => {
const wrapper = mount((
<MemoryRouter>
<Provider store={store}>
<CodeSearchResults
onClose={jest.fn()}
searchQuery="[email protected]"
isOpen
/>
<IntlProvider locale="en">
<CodeSearchResults
onClose={jest.fn()}
searchQuery="[email protected]"
isOpen
/>
</IntlProvider>
</Provider>
</MemoryRouter>
));
Expand Down Expand Up @@ -360,11 +375,13 @@ describe('<CodeSearchResults />', () => {
const wrapper = mount((
<MemoryRouter>
<Provider store={store}>
<CodeSearchResults
onClose={jest.fn()}
searchQuery="[email protected]"
isOpen
/>
<IntlProvider locale="en">
<CodeSearchResults
onClose={jest.fn()}
searchQuery="[email protected]"
isOpen
/>
</IntlProvider>
</Provider>
</MemoryRouter>
));
Expand Down Expand Up @@ -405,11 +422,13 @@ describe('<CodeSearchResults />', () => {
const wrapper = mount((
<MemoryRouter>
<Provider store={store}>
<CodeSearchResults
onClose={jest.fn()}
searchQuery="[email protected]"
isOpen
/>
<IntlProvider locale="en">
<CodeSearchResults
onClose={jest.fn()}
searchQuery="[email protected]"
isOpen
/>
</IntlProvider>
</Provider>
</MemoryRouter>
));
Expand Down Expand Up @@ -441,11 +460,13 @@ describe('<CodeSearchResults />', () => {
const wrapper = mount((
<MemoryRouter>
<Provider store={store}>
<CodeSearchResults
onClose={mockOnClose}
searchQuery="[email protected]"
isOpen
/>
<IntlProvider locale="en">
<CodeSearchResults
onClose={mockOnClose}
searchQuery="[email protected]"
isOpen
/>
</IntlProvider>
</Provider>
</MemoryRouter>
));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -611,11 +611,7 @@ exports[`<CodeSearchResults /> basic rendering should render table data 1`] = `
<div
className="pgn__smart-status"
>
Showing
4
of
0
.
Showing 4 of 0.
</div>
</div>
<div
Expand Down Expand Up @@ -1095,11 +1091,7 @@ exports[`<CodeSearchResults /> basic rendering should render table data when sea
<div
className="pgn__smart-status"
>
Showing
1
of
0
.
Showing 1 of 0.
</div>
</div>
<div
Expand Down
10 changes: 7 additions & 3 deletions src/components/CouponDetails/index.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { MemoryRouter } from 'react-router-dom';
import configureMockStore from 'redux-mock-store';
import thunk from 'redux-thunk';
import userEvent from '@testing-library/user-event';
import { IntlProvider } from '@edx/frontend-platform/i18n';

import { renderWithRouter } from '../test/testUtils';
import CouponDetails from './index';
import { COUPON_FILTERS, DEFAULT_TABLE_COLUMNS } from './constants';
Expand Down Expand Up @@ -135,9 +137,11 @@ const defaultProps = {
const CouponDetailsWrapper = props => (
<MemoryRouter>
<Provider store={mockStore(reduxState)}>
<CouponDetails
{...props}
/>
<IntlProvider locale="en">
<CouponDetails
{...props}
/>
</IntlProvider>
</Provider>
</MemoryRouter>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 '.';

Expand Down Expand Up @@ -95,19 +96,23 @@ const enrolledLearnersForInactiveCoursesStore = mockStore({
const EnrolledLearnersForInactiveCoursesEmptyTableWrapper = props => (
<MemoryRouter>
<Provider store={enrolledLearnersForInactiveCoursesEmptyStore}>
<EnrolledLearnersForInactiveCoursesTable
{...props}
/>
<IntlProvider locale="en">
<EnrolledLearnersForInactiveCoursesTable
{...props}
/>
</IntlProvider>
</Provider>
</MemoryRouter>
);

const EnrolledLearnersForInactiveCoursesWrapper = props => (
<MemoryRouter>
<Provider store={enrolledLearnersForInactiveCoursesStore}>
<EnrolledLearnersForInactiveCoursesTable
{...props}
/>
<IntlProvider locale="en">
<EnrolledLearnersForInactiveCoursesTable
{...props}
/>
</IntlProvider>
</Provider>
</MemoryRouter>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,7 @@ exports[`EnrolledLearnersForInactiveCoursesTable renders enrolled learners for i
<div
className="pgn__smart-status"
>
Showing
3
of
3
.
Showing 3 of 3.
</div>
</div>
<div
Expand Down
2 changes: 1 addition & 1 deletion src/components/EnterpriseApp/EnterpriseApp.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ describe('<EnterpriseApp />', () => {
expect(screen.getByText('/admin/coupons/request-codes')).toBeInTheDocument();
});
it('should enable code reporting screen', () => {
render(<EnterpriseApp {...basicProps} />);
render(<EnterpriseApp {...basicProps} enableReportingConfigurationsScreen />);
expect(screen.getByText('/admin/reporting')).toBeInTheDocument();
});
it('should enable code subscriptions screen', () => {
Expand Down
17 changes: 11 additions & 6 deletions src/components/LearnerActivityTable/LearnerActivityTable.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 '.';

Expand Down Expand Up @@ -84,19 +85,23 @@ const learnerActivityStore = mockStore({
const LearnerActivityEmptyTableWrapper = props => (
<MemoryRouter>
<Provider store={learnerActivityEmptyStore}>
<LearnerActivityTable
{...props}
/>
<IntlProvider locale="en">
<LearnerActivityTable
{...props}
/>
</IntlProvider>
</Provider>
</MemoryRouter>
);

const LearnerActivityTableWrapper = props => (
<MemoryRouter>
<Provider store={learnerActivityStore}>
<LearnerActivityTable
{...props}
/>
<IntlProvider locale="en">
<LearnerActivityTable
{...props}
/>
</IntlProvider>
</Provider>
</MemoryRouter>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,7 @@ exports[`LearnerActivityTable renders active learners table correctly 1`] = `
<div
className="pgn__smart-status"
>
Showing
2
of
2
.
Showing 2 of 2.
</div>
</div>
<div
Expand Down Expand Up @@ -761,11 +757,7 @@ exports[`LearnerActivityTable renders inactive past month learners table correct
<div
className="pgn__smart-status"
>
Showing
2
of
2
.
Showing 2 of 2.
</div>
</div>
<div
Expand Down Expand Up @@ -1448,11 +1440,7 @@ exports[`LearnerActivityTable renders inactive past week learners table correctl
<div
className="pgn__smart-status"
>
Showing
2
of
2
.
Showing 2 of 2.
</div>
</div>
<div
Expand Down
Loading

0 comments on commit dc04679

Please sign in to comment.