Skip to content

Commit 8ec0835

Browse files
committed
test: add ChannelList test for Search display
1 parent 9bc0575 commit 8ec0835

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/components/ChannelList/__tests__/ChannelList.test.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,23 @@ describe('ChannelList', () => {
304304
expect(results).toHaveNoViolations();
305305
});
306306

307+
it('renders Search component if searchController state indicates active search', async () => {
308+
const searchController = new SearchController();
309+
const searchTestId = 'search-test-id';
310+
const Search = () => <div data-testid={searchTestId} />;
311+
const client = await getTestClientWithUser({ id: 'userId' });
312+
313+
render(
314+
<Chat client={client} Search={Search} searchController={searchController}>
315+
<ChannelList showChannelSearch />
316+
</Chat>,
317+
);
318+
await act(() => {
319+
searchController.activate();
320+
});
321+
expect(screen.getByTestId(searchTestId)).toBeInTheDocument();
322+
});
323+
307324
it('should render `LoadingErrorIndicator` when queryChannels api throws error', async () => {
308325
useMockedApis(chatClient, [erroredPostApi()]);
309326
jest.spyOn(console, 'warn').mockImplementationOnce(() => null);

0 commit comments

Comments
 (0)