2020-11-11 07:09:06 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
RSpec.describe API::NpmInstancePackages do
|
2021-02-18 13:10:41 -05:00
|
|
|
# We need to create a subgroup with the same name as the hosting group.
|
|
|
|
# It has to be created first to exhibit this bug: https://gitlab.com/gitlab-org/gitlab/-/issues/321958
|
|
|
|
let_it_be(:another_namespace) { create(:group, :public) }
|
|
|
|
let_it_be(:similarly_named_group) { create(:group, :public, parent: another_namespace, name: 'test-group') }
|
|
|
|
|
2020-11-11 07:09:06 -05:00
|
|
|
include_context 'npm api setup'
|
|
|
|
|
2021-09-14 14:12:06 -04:00
|
|
|
describe 'GET /api/v4/packages/npm/*package_name' do
|
|
|
|
it_behaves_like 'handling get metadata requests', scope: :instance do
|
|
|
|
let(:url) { api("/packages/npm/#{package_name}") }
|
2021-09-07 17:10:59 -04:00
|
|
|
end
|
2021-09-14 14:12:06 -04:00
|
|
|
end
|
2021-09-07 17:10:59 -04:00
|
|
|
|
2021-09-14 14:12:06 -04:00
|
|
|
describe 'GET /api/v4/packages/npm/-/package/*package_name/dist-tags' do
|
|
|
|
it_behaves_like 'handling get dist tags requests', scope: :instance do
|
|
|
|
let(:url) { api("/packages/npm/-/package/#{package_name}/dist-tags") }
|
2020-11-11 07:09:06 -05:00
|
|
|
end
|
2021-09-14 14:12:06 -04:00
|
|
|
end
|
2020-11-11 07:09:06 -05:00
|
|
|
|
2021-09-14 14:12:06 -04:00
|
|
|
describe 'PUT /api/v4/packages/npm/-/package/*package_name/dist-tags/:tag' do
|
|
|
|
it_behaves_like 'handling create dist tag requests', scope: :instance do
|
|
|
|
let(:url) { api("/packages/npm/-/package/#{package_name}/dist-tags/#{tag_name}") }
|
2020-11-11 07:09:06 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-09-14 14:12:06 -04:00
|
|
|
describe 'DELETE /api/v4/packages/npm/-/package/*package_name/dist-tags/:tag' do
|
|
|
|
it_behaves_like 'handling delete dist tag requests', scope: :instance do
|
|
|
|
let(:url) { api("/packages/npm/-/package/#{package_name}/dist-tags/#{tag_name}") }
|
2020-11-11 07:09:06 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|