File size: 837 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
37
38
39
40
41
42
43
44
45
// @flow
import { request } from '../utils';
import data from 'shared/testing/data';

it('should fetch a message', async () => {
  const query = /* GraphQL */ `
    {
      message(id: "${data.messages[0].id}") {
        id
        timestamp
        content {
          body
        }
        messageType
      }
    }
  `;

  expect.hasAssertions();
  const result = await request(query);

  expect(result).toMatchSnapshot();
});

describe('sender', () => {
  it('should fetch a user', async () => {
    const query = /* GraphQL */ `
      {
        message(id: "${data.messages[0].id}") {
          author {
            id
            user { 
              username
            }
          }
        }
      }
    `;

    expect.hasAssertions();
    const result = await request(query);
    expect(result).toMatchSnapshot();
  });
});