Skip to content

Commit 1fcc23a

Browse files
committed
Fix jest tests
1 parent 1da26a4 commit 1fcc23a

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

tests/test-components/BranchMenu.spec.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import { mount, render, shallow } from 'enzyme';
21
import { showDialog } from '@jupyterlab/apputils';
2+
import ClearIcon from '@material-ui/icons/Clear';
3+
import { mount, render, shallow } from 'enzyme';
34
import 'jest';
45
import * as React from 'react';
56
import { ActionButton } from '../../src/components/ActionButton';
@@ -8,7 +9,7 @@ import * as git from '../../src/git';
89
import { Logger } from '../../src/logger';
910
import { GitExtension } from '../../src/model';
1011
import { listItemClass, nameClass } from '../../src/style/BranchMenu';
11-
import { mockedRequestAPI, defaultMockedResponses } from '../utils';
12+
import { defaultMockedResponses, mockedRequestAPI } from '../utils';
1213

1314
jest.mock('../../src/git');
1415
jest.mock('@jupyterlab/apputils');
@@ -130,7 +131,7 @@ describe('BranchMenu', () => {
130131
component.setState({
131132
filter: 'foo'
132133
});
133-
const nodes = component.find('ClearIcon');
134+
const nodes = component.find(ClearIcon);
134135
expect(nodes.length).toEqual(1);
135136
});
136137

@@ -140,7 +141,7 @@ describe('BranchMenu', () => {
140141
filter: 'foo'
141142
});
142143
const html = component
143-
.find('ClearIcon')
144+
.find(ClearIcon)
144145
.first()
145146
.html();
146147
expect(html.includes('<title>')).toEqual(true);
@@ -167,7 +168,7 @@ describe('BranchMenu', () => {
167168

168169
// Should contain the branch names...
169170
for (let i = 0; i < branches.length; i++) {
170-
expect(nodes[i].lastChild.data).toEqual(branches[i].name);
171+
expect((nodes[i] as any).lastChild.data).toEqual(branches[i].name);
171172
}
172173
});
173174

@@ -280,7 +281,7 @@ describe('BranchMenu', () => {
280281
expect(nodes.length).toEqual(branches.length);
281282

282283
for (let i = 0; i < branches.length; i++) {
283-
expect(nodes[i].attribs['title'].length).toBeGreaterThan(0);
284+
expect((nodes[i] as any).attribs['title'].length).toBeGreaterThan(0);
284285
}
285286
});
286287

0 commit comments

Comments
 (0)