aboutsummaryrefslogtreecommitdiffstats
path: root/src/services/graphql/mutators/create-comment.test.ts
blob: b3742f5e4d610250055e3e7b366e27aace0f552a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { describe, expect, it } from '@jest/globals';
import { type CreateCommentInput, createComment } from './create-comment';

describe('create-comment', () => {
  it('successfully create a new comment', async () => {
    const email: CreateCommentInput = {
      author: 'Bruce_Lowe12',
      authorEmail: 'Wiley_Wolf18@example.net',
      authorUrl: '',
      clientMutationId: 'aliquid',
      commentOn: 2,
      content: 'Error vel fugit nisi accusantium.',
    };
    const result = await createComment(email);

    // eslint-disable-next-line @typescript-eslint/no-magic-numbers
    expect.assertions(3);

    expect(result.clientMutationId).toBe(email.clientMutationId);
    expect(result.comment?.approved).toBe(true);
    expect(result.success).toBe(true);
  });
});