diff options
Diffstat (limited to 'spec/graphql/types/issue_type_spec.rb')
-rw-r--r-- | spec/graphql/types/issue_type_spec.rb | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/spec/graphql/types/issue_type_spec.rb b/spec/graphql/types/issue_type_spec.rb index 1b8bf007a73..1d4590cbb4e 100644 --- a/spec/graphql/types/issue_type_spec.rb +++ b/spec/graphql/types/issue_type_spec.rb @@ -18,7 +18,7 @@ RSpec.describe GitlabSchema.types['Issue'] do confidential hidden discussion_locked upvotes downvotes merge_requests_count user_notes_count user_discussions_count web_path web_url relative_position emails_disabled subscribed time_estimate total_time_spent human_time_estimate human_total_time_spent closed_at created_at updated_at task_completion_status design_collection alert_management_alert severity current_user_todos moved moved_to - create_note_email timelogs project_id customer_relations_contacts] + create_note_email timelogs project_id customer_relations_contacts escalation_status] fields.each do |field_name| expect(described_class).to have_graphql_field(field_name) @@ -257,4 +257,49 @@ RSpec.describe GitlabSchema.types['Issue'] do end end end + + describe 'escalation_status' do + let_it_be(:user) { create(:user) } + let_it_be(:project) { create(:project, :public) } + let_it_be(:issue, reload: true) { create(:issue, project: project) } + + let(:execute) { GitlabSchema.execute(query, context: { current_user: user }).as_json } + let(:query) do + %( + query { + project(fullPath: "#{project.full_path}") { + issue(iid: "#{issue.iid}") { + escalationStatus + } + } + } + ) + end + + subject(:status) { execute.dig('data', 'project', 'issue', 'escalationStatus') } + + it { is_expected.to be_nil } + + context 'for an incident' do + before do + issue.update!(issue_type: Issue.issue_types[:incident]) + end + + it { is_expected.to be_nil } + + context 'with an escalation status record' do + let!(:escalation_status) { create(:incident_management_issuable_escalation_status, issue: issue) } + + it { is_expected.to eq(escalation_status.status_name.to_s.upcase) } + + context 'with feature disabled' do + before do + stub_feature_flags(incident_escalations: false) + end + + it { is_expected.to be_nil } + end + end + end + end end |