Skip to content
Snippets Groups Projects
Commit a14466e8 authored by Reinder Kraaij's avatar Reinder Kraaij :eye:
Browse files

added comment to unit test

parent e933cfc8
No related branches found
No related tags found
1 merge request!1174Resolve TMS-2810 "Test fixes part 3"
...@@ -28,8 +28,8 @@ describe('PanelButtons', () => { ...@@ -28,8 +28,8 @@ describe('PanelButtons', () => {
}); });
it('adjusts left panel size when summary is not active', async () => { it('adjusts left panel size when summary is not active', async () => {
const setLeftPanelSizeMock = jest.fn(); let setLeftPanelSizeMock = jest.fn();
const pannelComponent = render(<PanelButtons const pannelComponent = render(<PanelButtons
showLegendbar={false} showLegendbar={false}
setShowLegendbar={jest.fn()} setShowLegendbar={jest.fn()}
showListTabs={true} showListTabs={true}
...@@ -38,7 +38,7 @@ describe('PanelButtons', () => { ...@@ -38,7 +38,7 @@ describe('PanelButtons', () => {
leftPanelSize={20} leftPanelSize={20}
setLeftPanelSize={setLeftPanelSizeMock} />); setLeftPanelSize={setLeftPanelSizeMock} />);
await waitFor(() => expect(pannelComponent.getByTitle(shrinkLabel).tobeinTheDocument)); await waitFor(() => expect(pannelComponent.getByTitle(shrinkLabel).tobeinTheDocument));
const shrinkButton = pannelComponent.getByTitle(shrinkLabel); const shrinkButton = pannelComponent.getByTitle(shrinkLabel);
clickItem(shrinkButton) clickItem(shrinkButton)
expect(setLeftPanelSizeMock).toHaveBeenCalledWith(10); // 10% shrink expect(setLeftPanelSizeMock).toHaveBeenCalledWith(10); // 10% shrink
...@@ -47,11 +47,16 @@ describe('PanelButtons', () => { ...@@ -47,11 +47,16 @@ describe('PanelButtons', () => {
clickItem(expandButton) clickItem(expandButton)
expect(setLeftPanelSizeMock).toHaveBeenCalledWith(30); // 10% expand expect(setLeftPanelSizeMock).toHaveBeenCalledWith(30); // 10% expand
setLeftPanelSizeMock=null;
}); });
// this test can fail, allthough it's good. SOmething with Jest and React 18 running compatibility mode
it('disables resize buttons when summary is active', async () => { it('disables resize buttons when summary is active', async () => {
const pannelComponent = render(<PanelButtons
let pannelComponentb = render(<PanelButtons
showLegendbar={false} showLegendbar={false}
setShowLegendbar={jest.fn()} setShowLegendbar={jest.fn()}
showListTabs={true} showListTabs={true}
...@@ -60,12 +65,13 @@ describe('PanelButtons', () => { ...@@ -60,12 +65,13 @@ describe('PanelButtons', () => {
leftPanelSize={20} leftPanelSize={20}
setLeftPanelSize={ jest.fn()} />); setLeftPanelSize={ jest.fn()} />);
await waitFor(() => expect(pannelComponent.getByTitle(shrinkLabel)));
const shrinkButton = pannelComponent.getByTitle(shrinkLabel); await waitFor(() => expect(pannelComponentb.getByTitle(shrinkLabel).tobeinTheDocument));
const shrinkButton = pannelComponentb.getByTitle(shrinkLabel);
expect(shrinkButton).toHaveAttribute("disabled") expect(shrinkButton).toHaveAttribute("disabled")
const expandButton = pannelComponent.getByTitle(expandLabel); const expandButton = pannelComponentb.getByTitle(expandLabel);
expect(expandButton).toHaveAttribute("disabled") expect(expandButton).toHaveAttribute("disabled")
}); });
}); });
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment