|
1 | 1 | import React from 'react'; |
2 | 2 | import { shallow } from '@edx/react-unit-test-utils'; |
3 | | -import { Provider } from 'react-redux'; |
4 | | -import { configureStore } from '@reduxjs/toolkit'; |
5 | 3 | import SourceCodeModal from '../SourceCodeModal'; |
6 | 4 | import ImageUploadModal from '../ImageUploadModal'; |
7 | 5 | import { imgModalToggle, sourceCodeModalToggle } from './hooks'; |
8 | 6 | import { TinyMceWidgetInternal as TinyMceWidget } from '.'; |
9 | 7 |
|
10 | 8 | const staticUrl = '/assets/sOmEaSsET'; |
11 | 9 |
|
12 | | -const mockStore = configureStore({ |
13 | | - reducer: { |
14 | | - // Add any required reducers for your tests |
15 | | - test: (state = {}) => state, |
16 | | - }, |
17 | | -}); |
18 | | - |
19 | | -// Helper function to create wrapped component |
20 | | -const shallowWithStore = (component) => shallow( |
21 | | - <Provider store={mockStore}> |
22 | | - {component} |
23 | | - </Provider>, |
24 | | -); |
25 | | - |
26 | 10 | // Per https://github.com/tinymce/tinymce-react/issues/91 React unit testing in JSDOM is not supported by tinymce. |
27 | 11 | // Consequently, mock the Editor out. |
28 | 12 | jest.mock('@tinymce/tinymce-react', () => { |
@@ -85,12 +69,12 @@ describe('TinyMceWidget', () => { |
85 | 69 | expect(shallow(<TinyMceWidget {...props} />).snapshot).toMatchSnapshot(); |
86 | 70 | }); |
87 | 71 | test('SourcecodeModal is not rendered', () => { |
88 | | - const wrapper = shallowWithStore(<TinyMceWidget {...props} editorType="problem" />); |
| 72 | + const wrapper = shallow(<TinyMceWidget {...props} editorType="problem" />); |
89 | 73 | expect(wrapper.snapshot).toMatchSnapshot(); |
90 | 74 | expect(wrapper.instance.findByType(SourceCodeModal).length).toBe(0); |
91 | 75 | }); |
92 | 76 | test('ImageUploadModal is not rendered', () => { |
93 | | - const wrapper = shallowWithStore(<TinyMceWidget {...props} enableImageUpload={false} />); |
| 77 | + const wrapper = shallow(<TinyMceWidget {...props} enableImageUpload={false} />); |
94 | 78 | expect(wrapper.snapshot).toMatchSnapshot(); |
95 | 79 | expect(wrapper.instance.findByType(ImageUploadModal).length).toBe(0); |
96 | 80 | }); |
|
0 commit comments