summaryrefslogtreecommitdiff
path: root/spec/requests/api/graphql/project/alert_management/alert/notes_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/requests/api/graphql/project/alert_management/alert/notes_spec.rb')
-rw-r--r--spec/requests/api/graphql/project/alert_management/alert/notes_spec.rb34
1 files changed, 30 insertions, 4 deletions
diff --git a/spec/requests/api/graphql/project/alert_management/alert/notes_spec.rb b/spec/requests/api/graphql/project/alert_management/alert/notes_spec.rb
index df6bfa8c97b..1350cba119b 100644
--- a/spec/requests/api/graphql/project/alert_management/alert/notes_spec.rb
+++ b/spec/requests/api/graphql/project/alert_management/alert/notes_spec.rb
@@ -2,15 +2,15 @@
require 'spec_helper'
-describe 'getting Alert Management Alert Notes' do
+RSpec.describe 'getting Alert Management Alert Notes' do
include GraphqlHelpers
let_it_be(:project) { create(:project) }
let_it_be(:current_user) { create(:user) }
let_it_be(:first_alert) { create(:alert_management_alert, project: project, assignees: [current_user]) }
let_it_be(:second_alert) { create(:alert_management_alert, project: project) }
- let_it_be(:first_system_note) { create(:note_on_alert, noteable: first_alert, project: project) }
- let_it_be(:second_system_note) { create(:note_on_alert, noteable: first_alert, project: project) }
+ let_it_be(:first_system_note) { create(:note_on_alert, :with_system_note_metadata, noteable: first_alert, project: project) }
+ let_it_be(:second_system_note) { create(:note_on_alert, :with_system_note_metadata, noteable: first_alert, project: project) }
let(:params) { {} }
@@ -21,6 +21,8 @@ describe 'getting Alert Management Alert Notes' do
notes {
nodes {
id
+ body
+ systemNoteIconName
}
}
}
@@ -44,7 +46,17 @@ describe 'getting Alert Management Alert Notes' do
project.add_developer(current_user)
end
- it 'returns the notes ordered by createdAt' do
+ it 'includes expected data' do
+ post_graphql(query, current_user: current_user)
+
+ expect(first_notes_result.first).to include(
+ 'id' => first_system_note.to_global_id.to_s,
+ 'systemNoteIconName' => 'git-merge',
+ 'body' => first_system_note.note
+ )
+ end
+
+ it 'returns the notes ordered by createdAt with sufficient content' do
post_graphql(query, current_user: current_user)
expect(first_notes_result.length).to eq(2)
@@ -64,4 +76,18 @@ describe 'getting Alert Management Alert Notes' do
expect { post_graphql(query, current_user: current_user) }.not_to exceed_query_limit(base_count)
expect(alerts_result.length).to eq(3)
end
+
+ context 'for non-system notes' do
+ let_it_be(:user_note) { create(:note_on_alert, noteable: second_alert, project: project) }
+
+ it 'includes expected data' do
+ post_graphql(query, current_user: current_user)
+
+ expect(second_notes_result.first).to include(
+ 'id' => user_note.to_global_id.to_s,
+ 'systemNoteIconName' => nil,
+ 'body' => user_note.note
+ )
+ end
+ end
end