@scryme/chat 2.91.7 → 2.91.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -53,6 +53,18 @@ vi.mock('../generated/v3-server', () => {
53
53
  channelsControllerRemoveReaction: vi.fn(async (channelId, messageId, emoji, options) => {
54
54
  return { success: true, type: 'channel', action: 'removeReaction', channelId, messageId, emoji, options };
55
55
  }),
56
+ channelsControllerGetChannelMembers: vi.fn(async (slug, channelId, options) => {
57
+ return { success: true, slug, channelId, members: [], options };
58
+ }),
59
+ channelsControllerAddChannelMembers: vi.fn(async (slug, channelId, data, options) => {
60
+ return { success: true, slug, channelId, data, options };
61
+ }),
62
+ channelsControllerUpdateChannelMember: vi.fn(async (slug, channelId, targetUserId, data, options) => {
63
+ return { success: true, slug, channelId, targetUserId, data, options };
64
+ }),
65
+ channelsControllerRemoveChannelMember: vi.fn(async (slug, channelId, targetUserId, options) => {
66
+ return { success: true, slug, channelId, targetUserId, options };
67
+ }),
56
68
 
57
69
  // DMs Mock
58
70
  dmsControllerGetDms: vi.fn(async (options) => {
@@ -151,6 +163,33 @@ vi.mock('../generated/v3-server', () => {
151
163
  v3WorkspacesControllerDeleteWorkspaceMember: vi.fn(async (slug, memberId, options) => {
152
164
  return { success: true, slug, memberId, options };
153
165
  }),
166
+ v3WorkspacesControllerGetChannels: vi.fn(async (slug, options) => {
167
+ return { success: true, data: { channels: [] }, slug, options };
168
+ }),
169
+ v3WorkspacesControllerCreateChannel: vi.fn(async (slug, data, options) => {
170
+ return { success: true, data: { channel: { name: data.name } }, slug, options };
171
+ }),
172
+ v3WorkspacesControllerGetChannel: vi.fn(async (slug, channelId, options) => {
173
+ return { success: true, data: { channel: { id: channelId } }, slug, options };
174
+ }),
175
+ v3WorkspacesControllerUpdateChannel: vi.fn(async (slug, channelId, data, options) => {
176
+ return { success: true, data: { channel: { id: channelId } }, slug, data, options };
177
+ }),
178
+ v3WorkspacesControllerDeleteChannel: vi.fn(async (slug, channelId, options) => {
179
+ return { success: true, data: { success: true }, slug, channelId, options };
180
+ }),
181
+ v3WorkspacesControllerGetChannelMembers: vi.fn(async (slug, channelId, options) => {
182
+ return { success: true, data: { members: [] }, slug, channelId, options };
183
+ }),
184
+ v3WorkspacesControllerAddChannelMembers: vi.fn(async (slug, channelId, data, options) => {
185
+ return { success: true, data: { members: [] }, slug, channelId, data, options };
186
+ }),
187
+ v3WorkspacesControllerUpdateChannelMember: vi.fn(async (slug, channelId, userId, data, options) => {
188
+ return { success: true, data: { member: { userId, role: data.role } }, slug, channelId, options };
189
+ }),
190
+ v3WorkspacesControllerDeleteChannelMember: vi.fn(async (slug, channelId, userId, options) => {
191
+ return { success: true, data: { success: true }, slug, channelId, userId, options };
192
+ }),
154
193
  v3OAuthControllerGetToken: vi.fn(async (data, options) => {
155
194
  return { success: true, data, options };
156
195
  }),
@@ -486,6 +525,16 @@ describe('ScrymeSDK', () => {
486
525
  // m2m.auth.token
487
526
  const tokenRes = await sdk.m2m.auth.token('cid', 'sec') as any;
488
527
  expect(tokenRes.data.client_id).toBe('cid');
528
+
529
+ // m2m.channel
530
+ const m2mChanList = await sdk.m2m.channel.list('acme') as any;
531
+ expect(m2mChanList.slug).toBe('acme');
532
+
533
+ const m2mChanCreate = await sdk.m2m.channel.create('acme', { name: 'tech', type: 'private' }) as any;
534
+ expect(m2mChanCreate.data.channel.name).toBe('tech');
535
+
536
+ const m2mMemUpdate = await sdk.m2m.channel.member.update('acme', 'ch-1', 'usr-1', { role: 'admin', permissions: '2048' }) as any;
537
+ expect(m2mMemUpdate.data.member.role).toBe('admin');
489
538
  });
490
539
 
491
540
  it('should support sdk.support ticketing and customer operations', async () => {