2020-07-28 23:09:34 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
2023-06-20 00:43:36 +05:30
|
|
|
RSpec.describe Packages::Npm::PackagePresenter, feature_category: :package_registry do
|
|
|
|
let_it_be(:metadata) do
|
|
|
|
{
|
|
|
|
name: 'foo',
|
|
|
|
versions: { '1.0.0' => { 'dist' => { 'tarball' => 'http://localhost/tarball.tgz' } } },
|
|
|
|
dist_tags: { 'latest' => '1.0.0' }
|
|
|
|
}
|
|
|
|
end
|
2021-11-11 11:23:49 +05:30
|
|
|
|
2023-06-20 00:43:36 +05:30
|
|
|
subject { described_class.new(metadata) }
|
2023-01-13 00:05:48 +05:30
|
|
|
|
2023-06-20 00:43:36 +05:30
|
|
|
describe '#name' do
|
|
|
|
it 'returns the name' do
|
|
|
|
expect(subject.name).to eq('foo')
|
2020-07-28 23:09:34 +05:30
|
|
|
end
|
2023-06-20 00:43:36 +05:30
|
|
|
end
|
2022-03-02 08:16:31 +05:30
|
|
|
|
2023-06-20 00:43:36 +05:30
|
|
|
describe '#versions' do
|
|
|
|
it 'returns the versions' do
|
|
|
|
expect(subject.versions).to eq({ '1.0.0' => { 'dist' => { 'tarball' => 'http://localhost/tarball.tgz' } } })
|
2022-03-02 08:16:31 +05:30
|
|
|
end
|
2020-07-28 23:09:34 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
describe '#dist_tags' do
|
2023-06-20 00:43:36 +05:30
|
|
|
it 'returns the dist_tags' do
|
|
|
|
expect(subject.dist_tags).to eq({ 'latest' => '1.0.0' })
|
2020-07-28 23:09:34 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|