Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/scheduled_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ jobs:

- uses: ./.github/actions/setup-node

- name: Build project
run: yarn build

- name: Run test
env:
API_KEY: ${{ secrets.TS_TEST_API_KEY }}
Expand Down
4 changes: 3 additions & 1 deletion test/typescript/response-generators/channel-search.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const { v4: uuid4 } = require('uuid');
// External uuid package not available, using test UUID for test data
const uuid4 = () =>
'test-' + Math.random().toString(36).substring(2, 15) + '-' + Date.now();
const utils = require('../utils');

const johnID = `john-${uuid4()}`;
Expand Down
4 changes: 3 additions & 1 deletion test/typescript/response-generators/channel-type.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const { generateUUIDv4: uuidv4 } = require('../../../src/utils');
// generateUUIDv4 is not exported from the public API, using test UUID for test data
const uuidv4 = () =>
'test-' + Math.random().toString(36).substring(2, 15) + '-' + Date.now();
const utils = require('../utils');

async function createChannelType() {
Expand Down
22 changes: 17 additions & 5 deletions test/typescript/response-generators/channel.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const { generateUUIDv4: uuidv4 } = require('../../../src/utils');
// generateUUIDv4 is not exported from the public API, using test UUID for test data
const uuidv4 = () =>
'test-' + Math.random().toString(36).substring(2, 15) + '-' + Date.now();
const utils = require('../utils');
const fs = require('fs');
const url = require('url');
Expand Down Expand Up @@ -28,15 +30,25 @@ async function addMembers() {
}

async function addFilterTags() {
const channel = await utils.createTestChannelForUser(uuidv4(), johnID);
await channel.watch();
// Use server-side client for filter tag operations (required by backend)
const serverClient = utils.getServerTestClient();
const channelId = uuidv4();
await utils.createUsers([johnID]);
const channel = serverClient.channel('messaging', channelId, { members: [johnID] });
await channel.create();

return await channel.addFilterTags(['tag1', 'tag2']);
}

async function removeFilterTags() {
const channel = await utils.createTestChannelForUser(uuidv4(), johnID);
await channel.watch();
// Use server-side client for filter tag operations (required by backend)
const serverClient = utils.getServerTestClient();
const channelId = uuidv4();
await utils.createUsers([johnID]);
const channel = serverClient.channel('messaging', channelId, { members: [johnID] });
await channel.create();
// Add tags first, then remove them
await channel.addFilterTags(['tag1', 'tag2']);

return await channel.removeFilterTags(['tag1']);
}
Expand Down
4 changes: 3 additions & 1 deletion test/typescript/response-generators/client.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const { generateUUIDv4: uuidv4 } = require('../../../src/utils');
// generateUUIDv4 is not exported from the public API, using test UUID for test data
const uuidv4 = () =>
'test-' + Math.random().toString(36).substring(2, 15) + '-' + Date.now();
const utils = require('../utils');

async function addDevice() {
Expand Down
4 changes: 3 additions & 1 deletion test/typescript/response-generators/event.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const { generateUUIDv4: uuidv4 } = require('../../../src/utils');
// generateUUIDv4 is not exported from the public API, using test UUID for test data
const uuidv4 = () =>
'test-' + Math.random().toString(36).substring(2, 15) + '-' + Date.now();
const utils = require('../utils');

const johnID = `john-${uuidv4()}`;
Expand Down
4 changes: 3 additions & 1 deletion test/typescript/response-generators/message.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const { generateUUIDv4: uuidv4 } = require('../../../src/utils');
// generateUUIDv4 is not exported from the public API, using test UUID for test data
const uuidv4 = () =>
'test-' + Math.random().toString(36).substring(2, 15) + '-' + Date.now();
const utils = require('../utils');

const johnID = `john-${uuidv4()}`;
Expand Down
4 changes: 3 additions & 1 deletion test/typescript/response-generators/moderation.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const { generateUUIDv4: uuidv4 } = require('../../../src/utils');
// generateUUIDv4 is not exported from the public API, using test UUID for test data
const uuidv4 = () =>
'test-' + Math.random().toString(36).substring(2, 15) + '-' + Date.now();
const utils = require('../utils');
const { sleep } = require('../utils');

Expand Down
4 changes: 3 additions & 1 deletion test/typescript/response-generators/reaction.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const { v4: uuid4 } = require('uuid');
// External uuid package not available, using test UUID for test data
const uuid4 = () =>
'test-' + Math.random().toString(36).substring(2, 15) + '-' + Date.now();
const utils = require('../utils');

const johnID = `john-${uuid4()}`;
Expand Down
4 changes: 3 additions & 1 deletion test/typescript/response-generators/update-users.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const { v4: uuid4 } = require('uuid');
// External uuid package not available, using test UUID for test data
const uuid4 = () =>
'test-' + Math.random().toString(36).substring(2, 15) + '-' + Date.now();
const utils = require('../utils');

async function deactivateUser() {
Expand Down
2 changes: 1 addition & 1 deletion test/typescript/utils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { StreamChat } = require('../../dist');
const { StreamChat } = require('../../dist/cjs/index.node.js');

require('dotenv').config({ path: `${process.cwd()}/test/typescript/.env` });

Expand Down
Loading