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

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

require 'spec_helper'

RSpec.describe GitlabSchema.types['CommitSignature'] do
  it 'exposes the expected fields' do
    expect(described_class).to have_graphql_fields(:verification_status, :commit_sha, :project)
  end

  describe '.resolve_type' do
    it 'resolves gpg signatures' do
      expect(described_class.resolve_type(build(:gpg_signature), {})).to eq(
        Types::CommitSignatures::GpgSignatureType)
    end

    it 'resolves x509 signatures' do
      expect(described_class.resolve_type(build(:x509_commit_signature), {})).to eq(
        Types::CommitSignatures::X509SignatureType)
    end

    it 'raises an error when type is not known' do
      expect { described_class.resolve_type(Class, {}) }.to raise_error('Unsupported commit signature type')
    end
  end
end