diff --git a/src/containers/CriterionContainer/CriterionFeedback.test.jsx b/src/containers/CriterionContainer/CriterionFeedback.test.jsx index 8657e23..aab1239 100644 --- a/src/containers/CriterionContainer/CriterionFeedback.test.jsx +++ b/src/containers/CriterionContainer/CriterionFeedback.test.jsx @@ -1,8 +1,7 @@ import React from 'react'; import { shallow } from 'enzyme'; -import actions from 'data/actions'; -import selectors from 'data/selectors'; +import { actions, selectors } from 'data/redux'; import { feedbackRequirement, gradeStatuses, diff --git a/src/containers/ListView/index.test.jsx b/src/containers/ListView/index.test.jsx index 282d6b5..93540f1 100644 --- a/src/containers/ListView/index.test.jsx +++ b/src/containers/ListView/index.test.jsx @@ -37,9 +37,19 @@ jest.mock('components/StatusBadge', () => 'StatusBadge'); jest.mock('containers/ReviewModal', () => 'ReviewModal'); jest.mock('./ListViewBreadcrumb', () => 'ListViewBreadcrumb'); -jest.mock('data/redux/submissions/selectors', () => ({ - submissions: { - listData: (...args) => ({ listData: args }), +jest.mock('data/redux', () => ({ + selectors: { + submissions: { + listData: (...args) => ({ listData: args }), + }, + }, + thunkActions: { + app: { + initialize: (...args) => ({ initialize: args }), + }, + grading: { + loadSelectionForReview: (...args) => ({ loadSelectionForReview: args }), + }, }, })); diff --git a/src/containers/ResponseDisplay/index.test.jsx b/src/containers/ResponseDisplay/index.test.jsx index 809aff9..e06723c 100644 --- a/src/containers/ResponseDisplay/index.test.jsx +++ b/src/containers/ResponseDisplay/index.test.jsx @@ -4,8 +4,8 @@ import { shallow } from 'enzyme'; import createDOMPurify from 'dompurify'; import parse from 'html-react-parser'; -import selectors from 'data/selectors'; import { fileUploadResponseOptions } from 'data/services/lms/constants'; +import { selectors } from 'data/redux'; import { ResponseDisplay, mapStateToProps } from '.'; @@ -17,9 +17,8 @@ jest.mock('@edx/paragon', () => { }; }); -jest.mock('data/selectors', () => ({ - __esModule: true, - default: { +jest.mock('data/redux', () => ({ + selectors: { grading: { selected: { response: (state) => ({ response: state }), diff --git a/src/containers/Rubric/__snapshots__/index.test.jsx.snap b/src/containers/Rubric/__snapshots__/index.test.jsx.snap index 5df0e64..7fc53d4 100644 --- a/src/containers/Rubric/__snapshots__/index.test.jsx.snap +++ b/src/containers/Rubric/__snapshots__/index.test.jsx.snap @@ -14,7 +14,9 @@ exports[`Rubric Container snapshot is grading 1`] = ` id="ora-grading.Rubric.rubric" /> -
+
-
+
({ })); jest.mock('data/redux/app/selectors', () => ({ - app: { - emptyGrade: (state) => ({ emptyGrade: state }), - }, + emptyGrade: (state) => ({ emptyGrade: state }), })); jest.mock('data/redux/grading/selectors', () => ({ - grading: { - prev: { - submissionId: (state) => ({ prevSubmissionId: state }), - doesExist: jest.fn((state) => ({ prevDoesExist: state })), - }, - next: { - submissionId: (state) => ({ prevSubmissionId: state }), - doesExist: jest.fn((state) => ({ nextDoesExist: state })), - }, - selected: { - submissionId: (state) => ({ selectedSubmissionId: state }), - gradeData: jest.fn((state) => ({ gradeData: state })), - }, + prev: { + submissionId: (state) => ({ prevSubmissionId: state }), + doesExist: jest.fn((state) => ({ prevDoesExist: state })), + }, + next: { + submissionId: (state) => ({ prevSubmissionId: state }), + doesExist: jest.fn((state) => ({ nextDoesExist: state })), + }, + selected: { + submissionId: (state) => ({ selectedSubmissionId: state }), + gradeData: jest.fn((state) => ({ gradeData: state })), }, })); diff --git a/src/data/store.test.js b/src/data/store.test.js index 1333033..f44bc0f 100644 --- a/src/data/store.test.js +++ b/src/data/store.test.js @@ -3,15 +3,16 @@ import thunkMiddleware from 'redux-thunk'; import { composeWithDevTools } from 'redux-devtools-extension/logOnlyInProduction'; import { createLogger } from 'redux-logger'; -import actions from './actions'; -import selectors from './selectors'; -import reducers from './reducers'; +import rootReducer, { actions, selectors } from 'data/redux'; import exportedStore, { createStore } from './store'; -jest.mock('./reducers', () => 'REDUCER'); -jest.mock('./actions', () => 'ACTIONS'); -jest.mock('./selectors', () => 'SELECTORS'); +jest.mock('data/redux', () => ({ + __esModule: true, + default: 'REDUCER', + actions: 'ACTIONS', + selectors: 'SELECTORS', +})); jest.mock('redux-logger', () => ({ createLogger: () => 'logger', @@ -31,7 +32,7 @@ describe('store aggregator module', () => { expect(exportedStore).toEqual(createStore()); }); it('creates store with connected reducers', () => { - expect(createStore().reducer).toEqual(reducers); + expect(createStore().reducer).toEqual(rootReducer); }); describe('middleware', () => { it('exports thunk and logger middleware, composed and applied with dev tools', () => { diff --git a/src/index.test.jsx b/src/index.test.jsx index d6212de..3b99601 100644 --- a/src/index.test.jsx +++ b/src/index.test.jsx @@ -16,6 +16,7 @@ jest.mock('react-dom', () => ({ render: jest.fn(), })); jest.mock('@edx/frontend-platform', () => ({ + ...jest.requireActual('@edx/frontend-platform'), APP_READY: 'app-is-ready-key', initialize: jest.fn(), subscribe: jest.fn(), diff --git a/src/test/app.test.jsx b/src/test/app.test.jsx index d41285a..74753b0 100644 --- a/src/test/app.test.jsx +++ b/src/test/app.test.jsx @@ -14,7 +14,7 @@ import { IntlProvider } from '@edx/frontend-platform/i18n'; import fakeData from 'data/services/lms/fakeData'; import api from 'data/services/lms/api'; -import reducers from 'data/reducers'; +import reducers from 'data/redux'; import { gradingStatuses } from 'data/services/lms/constants'; import messages from 'i18n'; import reviewActionsMessages from 'containers/ReviewActions/messages';