diff options
Diffstat (limited to 'spec/graphql/types/mutation_type_spec.rb')
-rw-r--r-- | spec/graphql/types/mutation_type_spec.rb | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/spec/graphql/types/mutation_type_spec.rb b/spec/graphql/types/mutation_type_spec.rb index a67d83b1edf..41993327577 100644 --- a/spec/graphql/types/mutation_type_spec.rb +++ b/spec/graphql/types/mutation_type_spec.rb @@ -2,8 +2,34 @@ require 'spec_helper' -describe Types::MutationType do +RSpec.describe Types::MutationType do it 'is expected to have the MergeRequestSetWip' do expect(described_class).to have_graphql_mutation(Mutations::MergeRequests::SetWip) end + + describe 'deprecated and aliased mutations' do + using RSpec::Parameterized::TableSyntax + + where(:alias_name, :canonical_name) do + 'AddAwardEmoji' | 'AwardEmojiAdd' + 'RemoveAwardEmoji' | 'AwardEmojiRemove' + 'ToggleAwardEmoji' | 'AwardEmojiToggle' + end + + with_them do + let(:alias_field) { get_field(alias_name) } + let(:canonical_field) { get_field(canonical_name) } + + it { expect(alias_field).to be_present } + it { expect(canonical_field).to be_present } + it { expect(alias_field.deprecation_reason).to be_present } + it { expect(canonical_field.deprecation_reason).not_to be_present } + it { expect(alias_field.resolver.fields).to eq(canonical_field.resolver.fields) } + it { expect(alias_field.resolver.arguments).to eq(canonical_field.resolver.arguments) } + end + + def get_field(name) + described_class.fields[GraphqlHelpers.fieldnamerize(name)] + end + end end |