Skip to content

Commit 3d71136

Browse files
committed
Pass eslint
1 parent 142e40b commit 3d71136

File tree

3 files changed

+51
-47
lines changed

3 files changed

+51
-47
lines changed

sdks/python/apache_beam/runners/interactive/extensions/apache-beam-jupyterlab-sidepanel/src/__tests__/inspector/Inspectables.test.tsx

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -57,22 +57,23 @@ afterEach(async () => {
5757
}
5858
});
5959

60-
it('renders info message about no inspectable when none is available', async () => {
61-
const inspectablesRef: React.RefObject<Inspectables> =
62-
React.createRef<Inspectables>();
63-
await act(async () => {
64-
root.render(<Inspectables ref={inspectablesRef} />);
65-
const inspectables = inspectablesRef.current;
66-
if (inspectables) {
67-
inspectables.setState({ inspectables: {} });
68-
}
60+
it('renders info message about no inspectable when none is available',
61+
async () => {
62+
const inspectablesRef: React.RefObject<Inspectables> =
63+
React.createRef<Inspectables>();
64+
await act(async () => {
65+
root.render(<Inspectables ref={inspectablesRef} />);
66+
const inspectables = inspectablesRef.current;
67+
if (inspectables) {
68+
inspectables.setState({ inspectables: {} });
69+
}
70+
});
71+
const infoElement: Element = container.firstElementChild;
72+
expect(infoElement.tagName).toBe('DIV');
73+
expect(infoElement.textContent).toBe(
74+
'No inspectable pipeline nor pcollection has been defined.'
75+
);
6976
});
70-
const infoElement: Element = container.firstElementChild;
71-
expect(infoElement.tagName).toBe('DIV');
72-
expect(infoElement.textContent).toBe(
73-
'No inspectable pipeline nor pcollection has been defined.'
74-
);
75-
});
7677

7778
it('renders inspectables as a list of collapsible lists', async () => {
7879
const inspectablesRef: React.RefObject<Inspectables> =

sdks/python/apache_beam/runners/interactive/extensions/apache-beam-jupyterlab-sidepanel/src/__tests__/inspector/InteractiveInspector.test.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ it('updates session info on change', async () => {
191191
await new Promise(resolve => setTimeout(resolve, 100));
192192
});
193193

194-
const topAppBarHeader: Element = container.firstElementChild.firstElementChild.firstElementChild.children[1];
194+
const topAppBarHeader: Element =
195+
container.firstElementChild.firstElementChild.firstElementChild.children[1];
195196
expect(topAppBarHeader.innerHTML).toContain('Inspector [kernel:new kernel]');
196197
});

sdks/python/apache_beam/runners/interactive/extensions/apache-beam-jupyterlab-sidepanel/src/__tests__/kernel/InterruptKernelButton.test.tsx

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -53,40 +53,42 @@ afterEach(async () => {
5353
}
5454
});
5555

56-
it('displays a button when the kernel model is not done with execution', async () => {
57-
let button: InterruptKernelButton;
58-
await act(async () => {
59-
root.render(
60-
<InterruptKernelButton
61-
ref={(node): void => {
62-
button = node;
63-
}}
64-
model={fakeKernelModel as any}
65-
/>
66-
);
67-
});
68-
await act(async () => {
69-
fakeKernelModel.isDone = false;
70-
button?.updateRender();
71-
await new Promise(resolve => setTimeout(resolve, 100));
56+
it('displays a button when the kernel model is not done with execution',
57+
async () => {
58+
let button: InterruptKernelButton;
59+
await act(async () => {
60+
root.render(
61+
<InterruptKernelButton
62+
ref={(node): void => {
63+
button = node;
64+
}}
65+
model={fakeKernelModel as any}
66+
/>
67+
);
68+
});
69+
await act(async () => {
70+
fakeKernelModel.isDone = false;
71+
button?.updateRender();
72+
await new Promise(resolve => setTimeout(resolve, 100));
73+
});
74+
const buttonElement: null | Element = container.firstElementChild;
75+
expect(buttonElement.tagName).toBe('BUTTON');
76+
expect(buttonElement.getAttribute('class')).toContain('mdc-button');
77+
expect(buttonElement.getAttribute('class')).toContain('mdc-button--raised');
78+
const labelElement: Element = buttonElement.children[1];
79+
expect(labelElement.tagName).toBe('SPAN');
80+
expect(labelElement.getAttribute('class')).toContain('mdc-button__label');
81+
expect(labelElement.innerHTML).toBe('stop');
7282
});
73-
const buttonElement: null | Element = container.firstElementChild;
74-
expect(buttonElement.tagName).toBe('BUTTON');
75-
expect(buttonElement.getAttribute('class')).toContain('mdc-button');
76-
expect(buttonElement.getAttribute('class')).toContain('mdc-button--raised');
77-
const labelElement: Element = buttonElement.children[1];
78-
expect(labelElement.tagName).toBe('SPAN');
79-
expect(labelElement.getAttribute('class')).toContain('mdc-button__label');
80-
expect(labelElement.innerHTML).toBe('stop');
81-
});
8283

83-
it('renders nothing when the kernel model is done with execution', async () => {
84-
await act(async () => {
85-
root.render(<InterruptKernelButton model={fakeKernelModel as any} />);
84+
it('renders nothing when the kernel model is done with execution',
85+
async () => {
86+
await act(async () => {
87+
root.render(<InterruptKernelButton model={fakeKernelModel as any} />);
88+
});
89+
const buttonElement: null | Element = container.firstElementChild;
90+
expect(buttonElement).toBe(null);
8691
});
87-
const buttonElement: null | Element = container.firstElementChild;
88-
expect(buttonElement).toBe(null);
89-
});
9092

9193
it('interrupts the kernel when clicked', async () => {
9294
let button: InterruptKernelButton;

0 commit comments

Comments
 (0)