Skip to content
This repository was archived by the owner on Oct 2, 2025. It is now read-only.

Commit 9951698

Browse files
Merge pull request #14 from openedx/bw/shallow-logging
fix: clean up test syntax
2 parents 95b0fab + d77d9aa commit 9951698

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/examples/ExampleComponent.test.jsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ jest.mock('./ImportedComponent', () => 'ImportedComponent');
1212
jest.mock('./hooks', () => ({ __esModule: true, default: jest.fn() }));
1313

1414
let el;
15-
let inst;
1615
let hookProps;
1716
describe('ExampleComponent component', () => {
1817
beforeAll(() => {
@@ -36,23 +35,20 @@ describe('ExampleComponent component', () => {
3635
expect(el.snapshot).toMatchSnapshot();
3736
});
3837
describe('output', () => {
39-
beforeEach(() => {
40-
inst = el.instance;
41-
});
4238
test('Form', () => {
43-
const control = inst.findByType(Form)[0];
39+
const control = el.instance.findByType(Form)[0];
4440
expect(control.props.action).toEqual(hookProps.formAction);
4541
});
4642
test('FileControl', () => {
47-
const control = inst.findByTestId(testIds.fileControl)[0];
43+
const control = el.instance.findByTestId(testIds.fileControl)[0];
4844
expect(control.props.onChange).toEqual(hookProps.handleFileInputChange);
4945
});
5046
test('imported component', () => {
51-
const control = inst.findByType(ImportedComponent)[0];
47+
const control = el.instance.findByType(ImportedComponent)[0];
5248
expect(control.props.onClick).toEqual(hookProps.handleClickImportedComponent);
5349
});
5450
test('random', () => {
55-
const control = inst.findByType('div')[0];
51+
const control = el.instance.findByType('div')[0];
5652
expect(control.matches(shallow(
5753
<div>
5854
<h1>{formatMessage(messages.heading)}</h1>

0 commit comments

Comments
 (0)