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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/api/entities/nuget/search_result_spec.rb')
-rw-r--r--spec/lib/api/entities/nuget/search_result_spec.rb57
1 files changed, 57 insertions, 0 deletions
diff --git a/spec/lib/api/entities/nuget/search_result_spec.rb b/spec/lib/api/entities/nuget/search_result_spec.rb
new file mode 100644
index 00000000000..2a760c70224
--- /dev/null
+++ b/spec/lib/api/entities/nuget/search_result_spec.rb
@@ -0,0 +1,57 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe API::Entities::Nuget::SearchResult do
+ let(:search_result) do
+ {
+ type: 'Package',
+ authors: 'Author',
+ name: 'PackageTest',
+ version: '1.2.3',
+ versions: [
+ {
+ json_url: 'http://sandbox.com/json/package',
+ downloads: 100,
+ version: '1.2.3'
+ }
+ ],
+ summary: 'Summary',
+ total_downloads: 100,
+ verified: true,
+ tags: 'tag1 tag2 tag3',
+ metadatum: {
+ project_url: 'http://sandbox.com/project',
+ license_url: 'http://sandbox.com/license',
+ icon_url: 'http://sandbox.com/icon'
+ }
+ }
+ end
+ let(:expected) do
+ {
+ '@type': 'Package',
+ 'authors': 'Author',
+ 'id': 'PackageTest',
+ 'title': 'PackageTest',
+ 'summary': 'Summary',
+ 'totalDownloads': 100,
+ 'verified': true,
+ 'version': '1.2.3',
+ 'tags': 'tag1 tag2 tag3',
+ 'projectUrl': 'http://sandbox.com/project',
+ 'licenseUrl': 'http://sandbox.com/license',
+ 'iconUrl': 'http://sandbox.com/icon',
+ 'versions': [
+ {
+ '@id': 'http://sandbox.com/json/package',
+ 'downloads': 100,
+ 'version': '1.2.3'
+ }
+ ]
+ }
+ end
+
+ subject { described_class.new(search_result).as_json }
+
+ it { is_expected.to eq(expected) }
+end