Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: enzyme testing replaced by react tester #35847

Open
wants to merge 57 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
9ee474e
fix: enzyme testing replaced by react tester
jciasenza Nov 14, 2024
0515fa7
Merge branch 'master' into jci/issue#35245
jciasenza Nov 14, 2024
72ae434
Merge branch 'master' into jci/issue#35245
jciasenza Nov 14, 2024
88dbcd9
Merge branch 'master' into jci/issue#35245
jciasenza Nov 15, 2024
296aaf8
Merge branch 'master' into jci/issue#35245
jciasenza Nov 15, 2024
e8ec7b6
Merge branch 'master' into jci/issue#35245
jciasenza Nov 15, 2024
62fee63
Merge branch 'master' into jci/issue#35245
jciasenza Nov 15, 2024
101bd51
fix: test enzyme
jciasenza Nov 15, 2024
ff3342b
Merge branch 'master' into jci/issue#35245
jciasenza Nov 15, 2024
d28850a
Merge branch 'master' into jci/issue#35245
jciasenza Nov 15, 2024
0895722
Merge branch 'master' into jci/issue#35245
jciasenza Nov 15, 2024
bf398e8
Merge branch 'master' into jci/issue#35245
jciasenza Nov 19, 2024
ae2ab90
Merge branch 'master' into jci/issue#35245
jciasenza Nov 19, 2024
9c56fd0
Merge branch 'master' into jci/issue#35245
jciasenza Nov 19, 2024
8e8bf61
Merge branch 'master' into jci/issue#35245
jciasenza Nov 19, 2024
de2a789
Merge branch 'master' into jci/issue#35245
jciasenza Nov 19, 2024
b90abef
Merge branch 'master' into jci/issue#35245
jciasenza Nov 19, 2024
4a5044e
Merge branch 'master' into jci/issue#35245
jciasenza Nov 20, 2024
4e33ff1
Merge branch 'master' into jci/issue#35245
jciasenza Nov 20, 2024
4769409
Merge branch 'master' into jci/issue#35245
jciasenza Nov 20, 2024
c673d38
Merge branch 'master' into jci/issue#35245
jciasenza Nov 20, 2024
1be5554
Merge branch 'master' into jci/issue#35245
jciasenza Nov 20, 2024
5677138
Merge branch 'master' into jci/issue#35245
jciasenza Nov 20, 2024
cea1e4f
Merge branch 'master' into jci/issue#35245
jciasenza Nov 21, 2024
f2bb89e
Merge branch 'master' into jci/issue#35245
jciasenza Nov 21, 2024
bc8506e
Merge branch 'master' into jci/issue#35245
jciasenza Nov 21, 2024
a5f0683
Merge branch 'master' into jci/issue#35245
jciasenza Nov 22, 2024
cb8dc1e
Merge branch 'master' into jci/issue#35245
jciasenza Nov 22, 2024
0d21077
Merge branch 'master' into jci/issue#35245
jciasenza Nov 22, 2024
5f0e136
Merge branch 'master' into jci/issue#35245
jciasenza Nov 25, 2024
a20a8dd
Merge branch 'master' into jci/issue#35245
jciasenza Nov 26, 2024
2851165
Merge branch 'master' into jci/issue#35245
jciasenza Nov 27, 2024
22003fa
Merge branch 'master' into jci/issue#35245
jciasenza Nov 28, 2024
dfa1c41
Merge branch 'master' into jci/issue#35245
jciasenza Dec 2, 2024
a6911bf
Merge branch 'master' into jci/issue#35245
jciasenza Dec 3, 2024
a77879c
Merge branch 'master' into jci/issue#35245
jciasenza Dec 4, 2024
a55c933
Merge branch 'master' into jci/issue#35245
jciasenza Dec 4, 2024
37d589a
Merge branch 'master' into jci/issue#35245
jciasenza Dec 4, 2024
4ed3e4a
Merge branch 'master' into jci/issue#35245
jciasenza Dec 5, 2024
e199f12
Merge branch 'master' into jci/issue#35245
jciasenza Dec 5, 2024
e92d60b
Merge branch 'master' into jci/issue#35245
jciasenza Dec 5, 2024
cab629a
Merge branch 'master' into jci/issue#35245
jciasenza Dec 6, 2024
3fac218
Merge branch 'master' into jci/issue#35245
jciasenza Dec 7, 2024
f149e7c
Merge branch 'master' into jci/issue#35245
jciasenza Dec 9, 2024
76b8723
Merge branch 'master' into jci/issue#35245
jciasenza Dec 9, 2024
3cda094
Merge branch 'master' into jci/issue#35245
jciasenza Dec 10, 2024
39177be
Merge branch 'master' into jci/issue#35245
jciasenza Dec 11, 2024
03a9f45
Merge branch 'master' into jci/issue#35245
jciasenza Dec 11, 2024
fb78f92
Merge branch 'master' into jci/issue#35245
jciasenza Dec 11, 2024
e41245c
Merge branch 'master' into jci/issue#35245
jciasenza Dec 11, 2024
d0b8f21
Merge branch 'master' into jci/issue#35245
jciasenza Dec 11, 2024
63e43b4
Merge branch 'master' into jci/issue#35245
jciasenza Dec 12, 2024
d4d1e54
Merge branch 'master' into jci/issue#35245
jciasenza Dec 13, 2024
0cf7862
Merge branch 'master' into jci/issue#35245
jciasenza Dec 13, 2024
887c197
Merge branch 'master' into jci/issue#35245
jciasenza Dec 16, 2024
0304a91
Merge branch 'master' into jci/issue#35245
jciasenza Dec 17, 2024
9c88980
Merge branch 'master' into jci/issue#35245
jciasenza Dec 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
// eslint-disable-next-line no-redeclare
/* global jest,test,describe,expect */
import { Button } from '@edx/paragon';
import BlockBrowserContainer from 'BlockBrowser/components/BlockBrowser/BlockBrowserContainer';
import { Provider } from 'react-redux';
import { shallow } from 'enzyme';
import React from 'react';
import { Provider } from 'react-redux';
import { act, create } from 'react-test-renderer';
import renderer from 'react-test-renderer';
import BlockBrowserContainer from 'BlockBrowser/components/BlockBrowser/BlockBrowserContainer';
import store from '../../data/store';

import Main from './Main';

describe('ProblemBrowser Main component', () => {
Expand All @@ -29,7 +26,7 @@ describe('ProblemBrowser Main component', () => {
selectedBlock={null}
taskStatusEndpoint={taskStatusEndpoint}
/>
</Provider>,
</Provider>
);
const tree = component.toJSON();
expect(tree).toMatchSnapshot();
Expand All @@ -48,7 +45,7 @@ describe('ProblemBrowser Main component', () => {
selectedBlock="some-selected-block"
taskStatusEndpoint={taskStatusEndpoint}
/>
</Provider>,
</Provider>
);
const tree = component.toJSON();
expect(tree).toMatchSnapshot();
Expand All @@ -68,29 +65,46 @@ describe('ProblemBrowser Main component', () => {
selectedBlock="some-selected-block"
taskStatusEndpoint={taskStatusEndpoint}
/>
</Provider>,
</Provider>
);
// eslint-disable-next-line prefer-destructuring
const instance = component.root.children[0].instance;
instance.handleToggleDropdown();
const root = component.root;

const button = root.findByProps({ label: 'Select a section or problem' });
act(() => {
button.props.onClick();
});

expect(fetchCourseBlocksMock.mock.calls.length).toBe(1);
});

test('display dropdown on toggling dropdown', () => {
const component = shallow(
<Main
courseId={courseId}
createProblemResponsesReportTask={jest.fn()}
excludeBlockTypes={excludedBlockTypes}
fetchCourseBlocks={jest.fn()}
problemResponsesEndpoint={problemResponsesEndpoint}
onSelectBlock={jest.fn()}
selectedBlock="some-selected-block"
taskStatusEndpoint={taskStatusEndpoint}
/>,
);
expect(component.find(BlockBrowserContainer).length).toBeFalsy();
component.find(Button).find({ label: 'Select a section or problem' }).simulate('click');
expect(component.find(BlockBrowserContainer).length).toBeTruthy();
let component;
act(() => {
component = create(
<Provider store={store}>
<Main
courseId={courseId}
createProblemResponsesReportTask={jest.fn()}
excludeBlockTypes={excludedBlockTypes}
fetchCourseBlocks={jest.fn()}
problemResponsesEndpoint={problemResponsesEndpoint}
onSelectBlock={jest.fn()}
selectedBlock="some-selected-block"
taskStatusEndpoint={taskStatusEndpoint}
/>
</Provider>
);
});

const root = component.root;

expect(() => root.findByType(BlockBrowserContainer)).toThrow();

const button = root.findByProps({ label: 'Select a section or problem' });
act(() => {
button.props.onClick();
});

expect(() => root.findByType(BlockBrowserContainer)).not.toThrow();
});
});