Skip to content

Commit

Permalink
update tests to use .keyboard for enter instead
Browse files Browse the repository at this point in the history
  • Loading branch information
ashokaditya committed Oct 22, 2024
1 parent 710fe62 commit 27ccdb0
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe('Users filter', () => {
const filterPrefix = 'users-filter';
let onChangeUsersFilter: jest.Mock;

beforeEach(async () => {
beforeEach(() => {
onChangeUsersFilter = jest.fn();
mockedContext = createAppRootMockRenderer();
({ history } = mockedContext);
Expand Down Expand Up @@ -57,7 +57,7 @@ describe('Users filter', () => {

const searchInput = renderResult.getByTestId(`${testPrefix}-${filterPrefix}-search`);
await userEvent.type(searchInput, 'usernameX');
await userEvent.type(searchInput, '{enter}');
await userEvent.keyboard('{enter}');
expect(onChangeUsersFilter).toHaveBeenCalledWith(['usernameX']);
});

Expand All @@ -66,7 +66,7 @@ describe('Users filter', () => {

const searchInput = renderResult.getByTestId(`${testPrefix}-${filterPrefix}-search`);
await userEvent.type(searchInput, 'usernameX,usernameY,usernameZ');
await userEvent.type(searchInput, '{enter}');
await userEvent.keyboard('{enter}');
expect(onChangeUsersFilter).toHaveBeenCalledWith(['usernameX', 'usernameY', 'usernameZ']);
});

Expand All @@ -75,7 +75,7 @@ describe('Users filter', () => {

const searchInput = renderResult.getByTestId(`${testPrefix}-${filterPrefix}-search`);
await userEvent.type(searchInput, ' usernameX ');
await userEvent.type(searchInput, '{enter}');
await userEvent.keyboard('{enter}');
expect(onChangeUsersFilter).toHaveBeenCalledWith(['usernameX']);
});

Expand All @@ -84,7 +84,7 @@ describe('Users filter', () => {

const searchInput = renderResult.getByTestId(`${testPrefix}-${filterPrefix}-search`);
await userEvent.type(searchInput, ' , usernameX ,usernameY , ');
await userEvent.type(searchInput, '{enter}');
await userEvent.keyboard('{enter}');
expect(onChangeUsersFilter).toHaveBeenCalledWith(['usernameX', 'usernameY']);
});
});

0 comments on commit 27ccdb0

Please sign in to comment.