Skip to content

Commit

Permalink
small adjustments in test
Browse files Browse the repository at this point in the history
  • Loading branch information
lassopicasso committed Dec 13, 2024
1 parent b4a5d82 commit b947002
Showing 1 changed file with 6 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,9 @@ describe('EditSubformTableColumns', () => {
},
});

const addColumnButton = getAddColumnButton();
await user.click(addColumnButton);

await user.click(getAddColumnButton());
expect(handleComponentChangeMock).toHaveBeenCalledTimes(1);

const numberOfColumnsAfterAdded = getUpdatedTableColumns(handleComponentChangeMock).length;
expect(numberOfColumnsAfterAdded).toBe(1);
});
Expand All @@ -62,8 +61,7 @@ describe('EditSubformTableColumns', () => {
props: { handleComponentChange: handleComponentChangeMock },
});

const addColumnButton = getAddColumnButton();
await user.click(addColumnButton);
await user.click(getAddColumnButton());
expect(handleComponentChangeMock).toHaveBeenCalledTimes(1);

const numberOfColumnsAfterAdded = getUpdatedTableColumns(handleComponentChangeMock).length;
Expand All @@ -83,8 +81,7 @@ describe('EditSubformTableColumns', () => {
});
await user.click(editButton);

const componentSelector = getComponentSelector();
await user.click(componentSelector);
await user.click(getComponentSelector());
await user.click(
screen.getByRole('option', { name: new RegExp(`${subformLayoutMock.component1Id}`) }),
);
Expand Down Expand Up @@ -146,9 +143,7 @@ describe('EditSubformTableColumns', () => {
props: { handleComponentChange: handleComponentChangeMock },
});

const addColumnButton = getAddColumnButton();
await user.click(addColumnButton);

await user.click(getAddColumnButton());
const updatedProps = {
handleComponentChange: handleComponentChangeMock,
component: {
Expand All @@ -157,9 +152,7 @@ describe('EditSubformTableColumns', () => {
},
};
rerender(<EditSubformTableColumns {...updatedProps} />);

const componentSelector = getComponentSelector();
expect(componentSelector).toBeInTheDocument();
expect(getComponentSelector()).toBeInTheDocument();
});
});

Expand Down

0 comments on commit b947002

Please sign in to comment.