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

metadata_index_presenter_spec.rb « v2 « nuget « packages « presenters « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 598db641b75e1da3e585f328f6e55abb0174d526 (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 Packages::Nuget::V2::MetadataIndexPresenter, feature_category: :package_registry do
  describe '#xml' do
    let(:presenter) { described_class.new }

    subject(:xml) { Nokogiri::XML(presenter.xml.to_xml) }

    specify { expect(xml.root.name).to eq('Edmx') }

    specify { expect(xml.at_xpath('//edmx:Edmx')).to be_present }

    specify { expect(xml.at_xpath('//edmx:Edmx/edmx:DataServices')).to be_present }

    specify do
      expect(xml.css('*').map(&:name)).to include(
        'Schema', 'EntityType', 'Key', 'PropertyRef', 'EntityContainer', 'EntitySet', 'FunctionImport', 'Parameter'
      )
    end

    specify do
      expect(xml.css('*').select { |el| el.name == 'Property' }.map { |el| el.attribute_nodes.first.value })
        .to match_array(
          %w[Id Version Authors Dependencies Description DownloadCount IconUrl Published ProjectUrl Tags Title
            LicenseUrl]
        )
    end

    specify { expect(xml.css('*').detect { |el| el.name == 'EntityContainer' }.attr('Name')).to eq('V2FeedContext') }

    specify { expect(xml.css('*').detect { |el| el.name == 'FunctionImport' }.attr('Name')).to eq('FindPackagesById') }
  end
end