Skip to content

Commit 6961d67

Browse files
authored
FEEDS-1195: Skip user flagging tests when moderation not enabled (#635)
* test: skip client.flagUser() integration test The client.flagUser() test requires moderation features to be enabled on the account. Skipping this test to prevent CI failures. * 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) * docs: explain why moderation tests are conditional Add comment explaining that APP_ID 6743 (default test app) can't have moderation enabled as it would break other existing tests. This is why we conditionally run moderation tests only on APP_ID 16792. * docs: simplify moderation test comment Remove internal implementation details and keep it professional. Just state that these tests require moderation features. * docs: clarify why moderation tests are conditional Explain that APP_ID 16792 has moderation enabled, while other test apps (e.g., StreamAPI CI) have it disabled, hence the conditional skip.
1 parent 7089f3e commit 6961d67

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

test/integration/cloud/user_flag.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
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+
// APP_ID 16792 has moderation enabled. Other test apps (e.g., from StreamAPI CI)
8+
// have moderation disabled, so we skip these tests there.
9+
const shouldRunModerationTests = config.APP_ID === '16792';
10+
const describeOrSkip = shouldRunModerationTests ? describe : describe.skip;
411

512
describe('User Flagging', () => {
613
const ctx = new CloudContext();
714

815
ctx.createUsers();
916

10-
describe('When creating activities to establish users in moderation system', () => {
17+
describeOrSkip('When creating activities to establish users in moderation system', () => {
1118
ctx.requestShouldNotError(async () => {
1219
// Create activities with users as actors to establish them in the moderation system
1320
// Using user1 and user2 which are commonly used across integration tests
@@ -26,7 +33,7 @@ describe('User Flagging', () => {
2633
});
2734
});
2835

29-
describe('When flagging a user with client.flagUser()', () => {
36+
describeOrSkip('When flagging a user with client.flagUser()', () => {
3037
ctx.requestShouldNotError(async () => {
3138
// Flag user1 (which exists in the moderation system from other tests)
3239
ctx.response = await ctx.serverSideClient.flagUser('user1', {
@@ -37,7 +44,7 @@ describe('User Flagging', () => {
3744
});
3845
});
3946

40-
describe('When flagging using user.flag()', () => {
47+
describeOrSkip('When flagging using user.flag()', () => {
4148
ctx.requestShouldNotError(async () => {
4249
// Flag using the user object method
4350
ctx.response = await ctx.serverSideClient.user('user1').flag({

0 commit comments

Comments
 (0)