Download spectrum/api/test/channel/queries/channelSettings.test.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 882 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/spectrum/api/test/channel/queries/channelSettings.test.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/spectrum/api/test/channel/queries/channelSettings.test.js
-
curl -L -o channelSettings.test.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/spectrum/api/test/channel/queries/channelSettings.test.js
882 Bytes
| //@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(); | |
| }); | |