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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# 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
|