Skip to content

Commit

Permalink
fix(tests): Update Typeahead selector in unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lordrip committed Jun 24, 2024
1 parent 08e3ec9 commit 5852d5c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe('DataFormatEditor', () => {

it('should render', async () => {
render(<DataFormatEditor selectedNode={mockNode} />);
const buttons = screen.getAllByRole('button', { name: 'Menu toggle' });
const buttons = screen.getAllByRole('button', { name: 'Typeahead menu toggle' });
await act(async () => {
fireEvent.click(buttons[0]);
});
Expand All @@ -61,7 +61,7 @@ describe('DataFormatEditor', () => {

it('should filter candidates with a text input', async () => {
render(<DataFormatEditor selectedNode={mockNode} />);
const buttons = screen.getAllByRole('button', { name: 'Menu toggle' });
const buttons = screen.getAllByRole('button', { name: 'Typeahead menu toggle' });
await act(async () => {
fireEvent.click(buttons[0]);
});
Expand All @@ -77,7 +77,7 @@ describe('DataFormatEditor', () => {

it('should clear filter and close the dropdown with close button', async () => {
render(<DataFormatEditor selectedNode={mockNode} />);
const buttons = screen.getAllByRole('button', { name: 'Menu toggle' });
const buttons = screen.getAllByRole('button', { name: 'Typeahead menu toggle' });
await act(async () => {
fireEvent.click(buttons[0]);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { LoadBalancerEditor } from './LoadBalancerEditor';
describe('LoadBalancerEditor', () => {
let mockNode: CanvasNode;
let loadbalancerCatalog: Record<string, ICamelLoadBalancerDefinition>;

beforeEach(async () => {
loadbalancerCatalog = await import('@kaoto/camel-catalog/' + catalogIndex.catalogs.loadbalancers.file);
/* eslint-disable @typescript-eslint/no-explicit-any */
Expand Down Expand Up @@ -50,7 +51,7 @@ describe('LoadBalancerEditor', () => {

it('should render', async () => {
render(<LoadBalancerEditor selectedNode={mockNode} />);
const buttons = screen.getAllByRole('button', { name: 'Menu toggle' });
const buttons = screen.getAllByRole('button', { name: 'Typeahead menu toggle' });
await act(async () => {
fireEvent.click(buttons[0]);
});
Expand All @@ -64,7 +65,7 @@ describe('LoadBalancerEditor', () => {

it('should filter candidates with a text input', async () => {
render(<LoadBalancerEditor selectedNode={mockNode} />);
const buttons = screen.getAllByRole('button', { name: 'Menu toggle' });
const buttons = screen.getAllByRole('button', { name: 'Typeahead menu toggle' });
await act(async () => {
fireEvent.click(buttons[0]);
});
Expand All @@ -80,7 +81,7 @@ describe('LoadBalancerEditor', () => {

it('should clear filter and close the dropdown with close button', async () => {
render(<LoadBalancerEditor selectedNode={mockNode} />);
const buttons = screen.getAllByRole('button', { name: 'Menu toggle' });
const buttons = screen.getAllByRole('button', { name: 'Typeahead menu toggle' });
await act(async () => {
fireEvent.click(buttons[0]);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ describe('CanvasForm', () => {
</VisibleFlowsProvider>
</EntitiesContext.Provider>,
);
const button = screen.getAllByRole('button', { name: 'Menu toggle' });
const button = screen.getAllByRole('button', { name: 'Typeahead menu toggle' });
await act(async () => {
fireEvent.click(button[0]);
});
Expand Down Expand Up @@ -507,7 +507,7 @@ describe('CanvasForm', () => {
expect(camelRoute.from.steps[0].marshal!.avro).toBeUndefined();
expect(camelRoute.from.steps[0].marshal!.id).toEqual('modified');

const button = screen.getAllByRole('button', { name: 'Menu toggle' });
const button = screen.getAllByRole('button', { name: 'Typeahead menu toggle' });
await act(async () => {
fireEvent.click(button[0]);
});
Expand Down Expand Up @@ -556,7 +556,7 @@ describe('CanvasForm', () => {
</VisibleFlowsProvider>
</EntitiesContext.Provider>,
);
const button = screen.getAllByRole('button', { name: 'Menu toggle' });
const button = screen.getAllByRole('button', { name: 'Typeahead menu toggle' });
await act(async () => {
fireEvent.click(button[0]);
});
Expand Down Expand Up @@ -613,7 +613,7 @@ describe('CanvasForm', () => {
expect(camelRoute.from.steps[0].loadBalance!.weighted).toBeUndefined();
expect(camelRoute.from.steps[0].loadBalance!.id).toEqual('modified');

const button = screen.getAllByRole('button', { name: 'Menu toggle' });
const button = screen.getAllByRole('button', { name: 'Typeahead menu toggle' });
await act(async () => {
fireEvent.click(button[0]);
});
Expand Down

0 comments on commit 5852d5c

Please sign in to comment.