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

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

require 'spec_helper'

RSpec.describe Types::WorkItems::WidgetDefinitionInterface, feature_category: :team_planning do
  it 'exposes the expected fields' do
    expected_fields = %i[
      type
    ]

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

  describe '.resolve_type' do
    subject { described_class.resolve_type(object, {}) }

    context 'for assignees widget' do
      let(:object) { WorkItems::Widgets::Assignees }

      it { is_expected.to eq(Types::WorkItems::WidgetDefinitions::AssigneesType) }
    end

    context 'for hierarchy widget' do
      let(:object) { WorkItems::Widgets::Hierarchy }

      it { is_expected.to eq(Types::WorkItems::WidgetDefinitions::HierarchyType) }
    end

    context 'for other widgets' do
      let(:object) { WorkItems::Widgets::Description }

      it { is_expected.to eq(Types::WorkItems::WidgetDefinitions::GenericType) }
    end
  end
end