Skip to content

Commit

Permalink
Merge pull request #14 from openedx/bw/shallow-logging
Browse files Browse the repository at this point in the history
fix: clean up test syntax
  • Loading branch information
muselesscreator authored Jun 29, 2023
2 parents 95b0fab + d77d9aa commit 9951698
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/examples/ExampleComponent.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ jest.mock('./ImportedComponent', () => 'ImportedComponent');
jest.mock('./hooks', () => ({ __esModule: true, default: jest.fn() }));

let el;
let inst;
let hookProps;
describe('ExampleComponent component', () => {
beforeAll(() => {
Expand All @@ -36,23 +35,20 @@ describe('ExampleComponent component', () => {
expect(el.snapshot).toMatchSnapshot();
});
describe('output', () => {
beforeEach(() => {
inst = el.instance;
});
test('Form', () => {
const control = inst.findByType(Form)[0];
const control = el.instance.findByType(Form)[0];
expect(control.props.action).toEqual(hookProps.formAction);
});
test('FileControl', () => {
const control = inst.findByTestId(testIds.fileControl)[0];
const control = el.instance.findByTestId(testIds.fileControl)[0];
expect(control.props.onChange).toEqual(hookProps.handleFileInputChange);
});
test('imported component', () => {
const control = inst.findByType(ImportedComponent)[0];
const control = el.instance.findByType(ImportedComponent)[0];
expect(control.props.onClick).toEqual(hookProps.handleClickImportedComponent);
});
test('random', () => {
const control = inst.findByType('div')[0];
const control = el.instance.findByType('div')[0];
expect(control.matches(shallow(
<div>
<h1>{formatMessage(messages.heading)}</h1>
Expand Down

0 comments on commit 9951698

Please sign in to comment.