Skip to content

Commit 15a2477

Browse files
committed
test: conditionally run user flagging tests based on APP_ID
Only run user flagging tests when APP_ID is 16792 (account with moderation enabled). This prevents test failures in environments without moderation features (e.g., StreamAPI repo). Tests will: - Run on APP_ID 16792 (moderation enabled) - Skip on other APP_IDs (moderation not enabled)
1 parent bcbae0c commit 15a2477

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

test/integration/cloud/user_flag.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
import expect from 'expect.js';
22

33
import { CloudContext } from './utils';
4+
import config from '../utils/config';
5+
6+
// User flagging requires moderation features to be enabled on the Stream account.
7+
// Only run these tests on accounts with moderation enabled (APP_ID 16792).
8+
const shouldRunModerationTests = config.APP_ID === '16792';
9+
const describeOrSkip = shouldRunModerationTests ? describe : describe.skip;
410

511
describe('User Flagging', () => {
612
const ctx = new CloudContext();
713

814
ctx.createUsers();
915

10-
describe('When creating activities to establish users in moderation system', () => {
16+
describeOrSkip('When creating activities to establish users in moderation system', () => {
1117
ctx.requestShouldNotError(async () => {
1218
// Create activities with users as actors to establish them in the moderation system
1319
// Using user1 and user2 which are commonly used across integration tests
@@ -26,7 +32,7 @@ describe('User Flagging', () => {
2632
});
2733
});
2834

29-
describe.skip('When flagging a user with client.flagUser()', () => {
35+
describeOrSkip('When flagging a user with client.flagUser()', () => {
3036
ctx.requestShouldNotError(async () => {
3137
// Flag user1 (which exists in the moderation system from other tests)
3238
ctx.response = await ctx.serverSideClient.flagUser('user1', {
@@ -37,7 +43,7 @@ describe('User Flagging', () => {
3743
});
3844
});
3945

40-
describe('When flagging using user.flag()', () => {
46+
describeOrSkip('When flagging using user.flag()', () => {
4147
ctx.requestShouldNotError(async () => {
4248
// Flag using the user object method
4349
ctx.response = await ctx.serverSideClient.user('user1').flag({

0 commit comments

Comments
 (0)