Skip to content

Commit 883a0c1

Browse files
committed
chore: move to new Stream app for testing
1 parent 35b1cee commit 883a0c1

File tree

3 files changed

+5
-53
lines changed

3 files changed

+5
-53
lines changed

__tests__/date-transform.test.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ describe('Date conversion', () => {
106106
it('users', async () => {
107107
const newUser: UserRequest = {
108108
id: uuidv4(),
109+
name: 'streamnodetest' + uuidv4(),
109110
custom: {
110111
created_at: new Date(),
111112
},
@@ -118,7 +119,5 @@ describe('Date conversion', () => {
118119
expect(
119120
typeof response.users[newUser.id].custom.created_at === 'string',
120121
).toBe(true);
121-
122-
await client.deleteUsers({ user_ids: [newUser.id] });
123122
});
124123
});

__tests__/messages.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ describe('messages API', () => {
121121
);
122122
});
123123

124-
it('translate', async () => {
124+
// Skipping to avoid rate limiting
125+
it.skip('translate', async () => {
125126
const response = await client.chat.translateMessage({
126127
id: messageId!,
127128
language: 'hu',

__tests__/webhook.test.ts

Lines changed: 2 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -9,58 +9,10 @@ describe('webhooks', () => {
99
client = createTestClient();
1010
});
1111

12-
it('verify webhook - call.session_participant_joined', async () => {
13-
const body = `{"type":"call.session_participant_joined","created_at":"2023-11-14T14:49:14.142187951Z","call_cid":"default:esJPeexho8md","session_id":"25a5b332-36f4-42c5-9fcb-a654bcaa2f3f","participant":{"user":{"id":"zita_szupera","name":"Zita Szupera","image":"https://lh3.googleusercontent.com/a/AAcHTtd__ATa58lPX-VAwJ46QU5arELhguPwTxoh9yzTaM_adw=s96-c","custom":{"imageUrl":"https://lh3.googleusercontent.com/a/AAcHTtd__ATa58lPX-VAwJ46QU5arELhguPwTxoh9yzTaM_adw=s120"},"role":"user","teams":[],"created_at":"2023-05-22T12:44:57.422509Z","updated_at":"2023-11-14T14:49:12.471772Z"},"user_session_id":"6245918f-461b-4d4f-b3f8-ed083e3cf867","role":"user","joined_at":"2023-11-14T14:49:14.142179098Z"}}`;
14-
const validSignature =
15-
'72b2a8f814b840e457882fd9968ac7f4210b23273461ab95365e9bf49fca12d8';
16-
const invalidSignature =
17-
'5d7fd77f8c3f92fc017a09775527716d22357f73d9d362435a7ed2a72d8c1a66';
18-
19-
let isValid = client.verifyWebhook(body, validSignature);
20-
21-
expect(isValid).toBe(true);
22-
23-
isValid = client.verifyWebhook(body, invalidSignature);
24-
25-
expect(isValid).toBe(false);
26-
});
27-
28-
it('verify webhook - call.session_participant_left', async () => {
29-
const body = `{"type":"call.session_participant_left","created_at":"2023-11-14T14:49:17.231445173Z","call_cid":"default:esJPeexho8md","session_id":"25a5b332-36f4-42c5-9fcb-a654bcaa2f3f","participant":{"user":{"id":"zita_szupera","name":"Zita Szupera","image":"https://lh3.googleusercontent.com/a/AAcHTtd__ATa58lPX-VAwJ46QU5arELhguPwTxoh9yzTaM_adw=s96-c","custom":{"imageUrl":"https://lh3.googleusercontent.com/a/AAcHTtd__ATa58lPX-VAwJ46QU5arELhguPwTxoh9yzTaM_adw=s120"},"role":"user","teams":[],"created_at":"2023-05-22T12:44:57.422509Z","updated_at":"2023-11-14T14:49:12.471772Z"},"user_session_id":"6245918f-461b-4d4f-b3f8-ed083e3cf867","role":"user","joined_at":"2023-11-14T14:49:17.231436648Z"}}`;
30-
const validSignature =
31-
'676dfafc03d08eeb9928af04169fd76a4a2efe8267f9f375bdd340c562fed37a';
32-
const invalidSignature =
33-
'5d7fd77f8c3f92fc017a09775527716d22357f73d9d362435a7ed2a72d8c1a66';
34-
35-
let isValid = client.verifyWebhook(body, validSignature);
36-
37-
expect(isValid).toBe(true);
38-
39-
isValid = client.verifyWebhook(body, invalidSignature);
40-
41-
expect(isValid).toBe(false);
42-
});
43-
4412
it('verify webhook - user.updated', async () => {
45-
const body = `{"type":"user.updated","user":{"id":"federico_guerinoni","role":"user","created_at":"2023-05-26T07:53:03.611031Z","updated_at":"2023-11-13T09:50:24.444759Z","last_active":"2023-11-10T15:27:36.208436Z","banned":false,"online":true,"name":"Federico Guerinoni","image":"https://lh3.googleusercontent.com/a/AGNmyxbj_VkTg2cbpxA0oODYVSvU4xLQihvT5ZBM7pdw=s96-c"},"created_at":"2023-11-13T09:50:24.447224815Z","members":[]}`;
46-
const validSignature =
47-
'35be5bf8e58170a042da724bba7d6b933d3f29ec85e6696ef1cf001e7c097fb8';
48-
const invalidSignature =
49-
'5d7fd77f8c3f92fc017a09775527716d22357f73d9d362435a7ed2a72d8c1a66';
50-
51-
let isValid = client.verifyWebhook(body, validSignature);
52-
53-
expect(isValid).toBe(true);
54-
55-
isValid = client.verifyWebhook(body, invalidSignature);
56-
57-
expect(isValid).toBe(false);
58-
});
59-
60-
it('verify webhook - channel.created', async () => {
61-
const body = `{"type":"channel.created","cid":"videocall:esJPeexho8md","channel_id":"esJPeexho8md","channel_type":"videocall","channel":{"id":"esJPeexho8md","type":"videocall","cid":"videocall:esJPeexho8md","created_at":"2023-11-14T14:49:12.81875Z","updated_at":"2023-11-14T14:49:12.81875Z","created_by":{"id":"zita_szupera","role":"user","created_at":"2023-05-22T12:44:57.422509Z","updated_at":"2023-11-14T14:49:12.471772Z","last_active":"2023-11-13T09:49:44.789879Z","banned":false,"online":false,"name":"Zita Szupera","image":"https://lh3.googleusercontent.com/a/AAcHTtd__ATa58lPX-VAwJ46QU5arELhguPwTxoh9yzTaM_adw=s96-c","imageUrl":"https://lh3.googleusercontent.com/a/AAcHTtd__ATa58lPX-VAwJ46QU5arELhguPwTxoh9yzTaM_adw=s120"},"frozen":false,"disabled":false,"config":{"created_at":"2023-02-16T15:06:02.355424Z","updated_at":"2023-04-03T16:20:57.360607Z","name":"videocall","typing_events":true,"read_events":true,"connect_events":true,"search":true,"reactions":true,"replies":false,"quotes":true,"mutes":true,"uploads":true,"url_enrichment":true,"custom_events":true,"push_notifications":true,"reminders":false,"mark_messages_pending":false,"message_retention":"infinite","max_message_length":5000,"automod":"disabled","automod_behavior":"flag","blocklist_behavior":"flag","commands":[{"name":"giphy","description":"Post a random gif to the channel","args":"[text]","set":"fun_set"},{"name":"ban","description":"Ban a user","args":"[@username] [text]","set":"moderation_set"},{"name":"unban","description":"Unban a user","args":"[@username]","set":"moderation_set"},{"name":"mute","description":"Mute a user","args":"[@username]","set":"moderation_set"},{"name":"unmute","description":"Unmute a user","args":"[@username]","set":"moderation_set"}]}},"user":{"id":"zita_szupera","role":"user","created_at":"2023-05-22T12:44:57.422509Z","updated_at":"2023-11-14T14:49:12.471772Z","last_active":"2023-11-13T09:49:44.789879Z","banned":false,"online":false,"name":"Zita Szupera","image":"https://lh3.googleusercontent.com/a/AAcHTtd__ATa58lPX-VAwJ46QU5arELhguPwTxoh9yzTaM_adw=s96-c","imageUrl":"https://lh3.googleusercontent.com/a/AAcHTtd__ATa58lPX-VAwJ46QU5arELhguPwTxoh9yzTaM_adw=s120"},"created_at":"2023-11-14T14:49:12.828267423Z","request_info":{"type":"client","ip":"89.134.25.76","user_agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36","sdk":"stream-chat-javascript-client-browser-8.13.0"}}`;
13+
const body = `{"type":"user.updated","created_at":"2026-04-08T14:23:35.879421674Z","user":{"id":"stream-node-test-user","name":"Stream Node Test User","language":"","role":"admin","teams":[],"created_at":"2025-10-20T15:13:35.51354Z","updated_at":"2026-04-08T14:23:35.873797Z","banned":false,"online":false,"blocked_user_ids":[],"invisible":false},"members":[],"request_info":{"type":"server","ip":"89.134.10.115","user_agent":"node","sdk":"stream-node-undefined"}}`;
6214
const validSignature =
63-
'6de7226ece892e191326906fea40473ae7f65aaa7426a13dddab517ab9338e41';
15+
'4292bbc126ee72b77f70cc7152906b9ecd96648bca92f15ea0e022c44fc6ad11';
6416
const invalidSignature =
6517
'5d7fd77f8c3f92fc017a09775527716d22357f73d9d362435a7ed2a72d8c1a66';
6618

0 commit comments

Comments
 (0)