Welcome to mirror list, hosted at ThFree Co, Russian Federation.

board_list_type_spec.rb « types « graphql « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d78d87c57bdce69cad7118aff3af1a9e52f5203a (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
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe GitlabSchema.types['BoardList'] do
  include GraphqlHelpers
  include Gitlab::Graphql::Laziness

  specify { expect(described_class.graphql_name).to eq('BoardList') }

  it 'has specific fields' do
    expected_fields = %w[id title list_type position label issues_count issues]

    expect(described_class).to include_graphql_fields(*expected_fields)
  end

  describe 'issues field' do
    subject { described_class.fields['issues'] }

    it 'has a correct extension' do
      is_expected.to have_graphql_extension(Gitlab::Graphql::Board::IssuesConnectionExtension)
    end
  end

  describe 'title' do
    subject(:field) { described_class.fields['title'] }

    it 'preloads the label association' do
      a, b, c = create_list(:list, 3).map { _1.class.find(_1.id) }

      baseline = ActiveRecord::QueryRecorder.new { force(resolve_field(field, a)) }

      expect do
        [resolve_field(field, b), resolve_field(field, c)].each { force _1 }
      end.not_to exceed_query_limit(baseline)
    end
  end
end