File size: 882 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//@flow
import { request } from '../../utils';
import data from 'shared/testing/data';
import {
  SPECTRUM_GENERAL_CHANNEL_ID,
  CHANNEL_MODERATOR_USER_ID,
} from '../../../migrations/seed/default/constants';

const channelModerator = data.users.find(
  ({ id }) => id === CHANNEL_MODERATOR_USER_ID
);

it('should fetch a private channels token join settings', async () => {
  const query = /* GraphQL */ `
    {
      channel(id: "${SPECTRUM_GENERAL_CHANNEL_ID}") {
        id
        joinSettings {
          tokenJoinEnabled
          token
        }
      }
    }
  `;

  expect.assertions(3);
  const result = await request(query, { context: { user: channelModerator } });
  const {
    data: { channel },
  } = result;

  expect(channel.joinSettings.tokenJoinEnabled).toEqual(false);
  expect(channel.joinSettings.token).toEqual(null);
  expect(result).toMatchSnapshot();
});