Skip to content

Commit

Permalink
test: remove unnecessary act
Browse files Browse the repository at this point in the history
Signed-off-by: Lin Wang <wonglam@amazon.com>
  • Loading branch information
wanglam committed Dec 12, 2023
1 parent 52e5ab5 commit 428c0d7
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions public/tabs/history/__tests__/chat_history_list.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import React from 'react';
import { act, fireEvent, render } from '@testing-library/react';
import { fireEvent, render } from '@testing-library/react';

import { ChatHistoryList } from '../chat_history_list';

Expand Down Expand Up @@ -36,9 +36,7 @@ describe('<ChatHistoryList />', () => {
);

expect(onChatHistoryTitleClickMock).not.toHaveBeenCalled();
act(() => {
fireEvent.click(getByText('foo'));
});
fireEvent.click(getByText('foo'));
expect(onChatHistoryTitleClickMock).toHaveBeenCalledWith('1', 'foo');
});

Expand All @@ -52,9 +50,7 @@ describe('<ChatHistoryList />', () => {
);

expect(onChatHistoryEditClickMock).not.toHaveBeenCalled();
act(() => {
fireEvent.click(getByLabelText('Edit conversation name'));
});
fireEvent.click(getByLabelText('Edit conversation name'));
expect(onChatHistoryEditClickMock).toHaveBeenCalledWith({ id: '1', title: 'foo' });
});

Expand All @@ -68,9 +64,7 @@ describe('<ChatHistoryList />', () => {
);

expect(onChatHistoryDeleteClickMock).not.toHaveBeenCalled();
act(() => {
fireEvent.click(getByLabelText('Delete conversation'));
});
fireEvent.click(getByLabelText('Delete conversation'));
expect(onChatHistoryDeleteClickMock).toHaveBeenCalledWith({ id: '1' });
});
});

0 comments on commit 428c0d7

Please sign in to comment.