Skip to content
Merged
Changes from all 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
13 changes: 10 additions & 3 deletions test/integration/cloud/user_flag.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
import expect from 'expect.js';

import { CloudContext } from './utils';
import config from '../utils/config';

// User flagging requires moderation features to be enabled on the Stream account.
// APP_ID 16792 has moderation enabled. Other test apps (e.g., from StreamAPI CI)
// have moderation disabled, so we skip these tests there.
const shouldRunModerationTests = config.APP_ID === '16792';
const describeOrSkip = shouldRunModerationTests ? describe : describe.skip;

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

ctx.createUsers();

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

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

describe('When flagging using user.flag()', () => {
describeOrSkip('When flagging using user.flag()', () => {
ctx.requestShouldNotError(async () => {
// Flag using the user object method
ctx.response = await ctx.serverSideClient.user('user1').flag({
Expand Down