diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-10-25 21:15:16 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-10-25 21:15:16 +0300 |
commit | 62866a623e24242c6f7a1a93dc2aca1467d6a6ae (patch) | |
tree | 322ce00c652d376c949f1d45c39764eeb5bce620 /spec/requests | |
parent | f8888a274f6b095075fd8648d3732ad577a3a742 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/api/graphql/work_item_spec.rb | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/spec/requests/api/graphql/work_item_spec.rb b/spec/requests/api/graphql/work_item_spec.rb index b8575b25e0a..1571066fac2 100644 --- a/spec/requests/api/graphql/work_item_spec.rb +++ b/spec/requests/api/graphql/work_item_spec.rb @@ -664,20 +664,6 @@ RSpec.describe 'Query.work_item(id)', feature_category: :team_planning do end describe 'notes widget' do - let(:work_item_fields) do - <<~GRAPHQL - id - widgets { - type - ... on WorkItemWidgetNotes { - system: discussions(filter: ONLY_ACTIVITY, first: 10) { nodes { id notes { nodes { id system internal body } } } }, - comments: discussions(filter: ONLY_COMMENTS, first: 10) { nodes { id notes { nodes { id system internal body } } } }, - all_notes: discussions(filter: ALL_NOTES, first: 10) { nodes { id notes { nodes { id system internal body } } } } - } - } - GRAPHQL - end - context 'when fetching award emoji from notes' do let(:work_item_fields) do <<~GRAPHQL @@ -768,6 +754,26 @@ RSpec.describe 'Query.work_item(id)', feature_category: :team_planning do expect { post_graphql(query, current_user: developer) }.not_to exceed_query_limit(control).with_threshold(4) expect_graphql_errors_to_be_empty end + + context 'when work item is associated with a group' do + let_it_be(:group_work_item) { create(:work_item, :group_level, namespace: group) } + let_it_be(:group_work_item_note) { create(:note, noteable: group_work_item, author: developer, project: nil) } + let(:global_id) { group_work_item.to_gid.to_s } + + before_all do + create(:award_emoji, awardable: group_work_item_note, name: 'rocket', user: developer) + end + + it 'returns notes for the group work item' do + all_widgets = graphql_dig_at(work_item_data, :widgets) + notes_widget = all_widgets.find { |x| x['type'] == 'NOTES' } + notes = graphql_dig_at(notes_widget['discussions'], :nodes).flat_map { |d| d['notes']['nodes'] } + + expect(notes).to contain_exactly( + hash_including('body' => group_work_item_note.note) + ) + end + end end end |