Skip to content

Commit 856bacd

Browse files
Adjust tests
1 parent 77391d5 commit 856bacd

3 files changed

Lines changed: 23 additions & 2 deletions

File tree

src/plugins/ChannelDetail/Views/ChannelMembersView/__tests__/ChannelMembersAddView.test.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ import { fireEvent, screen, waitFor } from '@testing-library/react';
22
import React from 'react';
33
import type { UserResponse } from 'stream-chat';
44

5-
import { useChatContext, useTranslationContext } from '../../../../../context';
5+
import {
6+
useChatContext,
7+
useComponentContext,
8+
useTranslationContext,
9+
} from '../../../../../context';
610
import { useStateStore } from '../../../../../store';
711
import { ChannelMembersAddView } from '../ChannelMembersAddView';
812
import {
@@ -93,6 +97,10 @@ describe('ChannelMembersAddView', () => {
9397
mutes: [],
9498
} as ReturnType<typeof useChatContext>);
9599

100+
vi.mocked(useComponentContext).mockReturnValue(
101+
{} as ReturnType<typeof useComponentContext>,
102+
);
103+
96104
vi.mocked(useStateStore).mockReturnValue({
97105
isLoading: false,
98106
users: searchUsers,

src/plugins/ChannelDetail/Views/ChannelMembersView/__tests__/ChannelMembersBrowseView.test.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ import { fireEvent, screen } from '@testing-library/react';
22
import React from 'react';
33
import type { ChannelMemberResponse } from 'stream-chat';
44

5-
import { useChatContext, useTranslationContext } from '../../../../../context';
5+
import {
6+
useChatContext,
7+
useComponentContext,
8+
useTranslationContext,
9+
} from '../../../../../context';
610
import { useStateStore } from '../../../../../store';
711
import { ChannelMembersBrowseView } from '../ChannelMembersBrowseView';
812
import { createChannel, emitChannelEvent, renderWithChannel } from './testUtils';
@@ -121,6 +125,10 @@ describe('ChannelMembersBrowseView', () => {
121125
mutes: [],
122126
} as ReturnType<typeof useChatContext>);
123127

128+
vi.mocked(useComponentContext).mockReturnValue(
129+
{} as ReturnType<typeof useComponentContext>,
130+
);
131+
124132
vi.mocked(useStateStore).mockReturnValue({
125133
isLoading: false,
126134
members,

src/plugins/ChannelDetail/Views/PinnedMessagesView/__tests__/PinnedMessagesView.test.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { fromPartial } from '@total-typescript/shoehorn';
66
import {
77
useChannelActionContext,
88
useChatContext,
9+
useComponentContext,
910
useModalContext,
1011
useTranslationContext,
1112
} from '../../../../../context';
@@ -214,6 +215,10 @@ describe('PinnedMessagesView', () => {
214215
client: { userID: 'user-1' },
215216
} as ReturnType<typeof useChatContext>);
216217

218+
vi.mocked(useComponentContext).mockReturnValue(
219+
{} as ReturnType<typeof useComponentContext>,
220+
);
221+
217222
vi.mocked(useModalContext).mockReturnValue({
218223
close: vi.fn(),
219224
} as ReturnType<typeof useModalContext>);

0 commit comments

Comments
 (0)