summaryrefslogtreecommitdiff
path: root/spec/contracts/consumer/fixtures/project/merge_requests/discussions.fixture.js
blob: 8c392395e1c741e25de5c36918b27d3618be0342 (plain)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import { Matchers } from '@pact-foundation/pact';

const body = Matchers.eachLike({
  id: Matchers.string('fd73763cbcbf7b29eb8765d969a38f7d735e222a'),
  reply_id: Matchers.string('fd73763cbcbf7b29eb8765d969a38f7d735e222a'),
  project_id: Matchers.integer(6954442),
  confidential: Matchers.boolean(false),
  diff_discussion: Matchers.boolean(false),
  expanded: Matchers.boolean(false),
  for_commit: Matchers.boolean(false),
  individual_note: Matchers.boolean(true),
  resolvable: Matchers.boolean(false),
  resolved_by_push: Matchers.boolean(false),
  notes: Matchers.eachLike({
    id: Matchers.string('76489845'),
    author: {
      id: Matchers.integer(1675733),
      username: Matchers.string('gitlab-qa-bot'),
      name: Matchers.string('gitlab-qa-bot'),
      state: Matchers.string('active'),
      avatar_url: Matchers.string(
        'https://secure.gravatar.com/avatar/8355ad0f2761367fae6b9c4fe80994b9?s=80&d=identicon',
      ),
      show_status: Matchers.boolean(false),
      path: Matchers.string('/gitlab-qa-bot'),
    },
    created_at: Matchers.iso8601DateTimeWithMillis('2022-02-22T07:06:55.038Z'),
    updated_at: Matchers.iso8601DateTimeWithMillis('2022-02-22T07:06:55.038Z'),
    system: Matchers.boolean(false),
    noteable_id: Matchers.integer(8333422),
    noteable_type: Matchers.string('MergeRequest'),
    resolvable: Matchers.boolean(false),
    resolved: Matchers.boolean(true),
    confidential: Matchers.boolean(false),
    noteable_iid: Matchers.integer(1),
    note: Matchers.string('This is a test comment'),
    note_html: Matchers.string(
      '<p data-sourcepos="1:1-1:22" dir="auto">This is a test comment</p>',
    ),
    current_user: {
      can_edit: Matchers.boolean(true),
      can_award_emoji: Matchers.boolean(true),
      can_resolve: Matchers.boolean(false),
      can_resolve_discussion: Matchers.boolean(false),
    },
    is_noteable_author: Matchers.boolean(true),
    discussion_id: Matchers.string('fd73763cbcbf7b29eb8765d969a38f7d735e222a'),
    emoji_awardable: Matchers.boolean(true),
    report_abuse_path: Matchers.string('/gitlab-qa-bot/...'),
    noteable_note_url: Matchers.string('https://staging.gitlab.com/gitlab-qa-bot/...'),
    cached_markdown_version: Matchers.integer(1900552),
    human_access: Matchers.string('Maintainer'),
    is_contributor: Matchers.boolean(false),
    project_name: Matchers.string('contract-testing'),
    path: Matchers.string('/gitlab-qa-bot/...'),
  }),
  resolved: Matchers.boolean(true),
});

const Discussions = {
  body: Matchers.extractPayload(body),

  success: {
    status: 200,
    headers: {
      'Content-Type': 'application/json; charset=utf-8',
    },
    body,
  },

  scenario: {
    state: 'a merge request with discussions exists',
    uponReceiving: 'a request for discussions',
  },

  request: {
    withRequest: {
      method: 'GET',
      path: '/gitlab-org/gitlab-qa/-/merge_requests/1/discussions.json',
      headers: {
        Accept: '*/*',
      },
    },
  },
};

export { Discussions };