Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add spec for agency in dois search response #1283

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions spec/requests/datacite_dois/datacite_dois_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,29 @@ def clear_doi_index
end
end

describe "GET /dois search with agency values", prefix_pool_size: 1 do
let!(:dois) { create_list(:doi, 10, client: client, aasm_state: "findable") }

before do
clear_doi_index
import_doi_index
end

it "returns agency values when flag is set" do
get "/dois?include_other_registration_agencies=true", nil, headers

expect(last_response.status).to eq(200)
expect(json.dig("data", 0, "attributes", "agency")).to eq("datacite")
end

it "does not returns agency values when flag isn't set" do
get "/dois", nil, headers

expect(last_response.status).to eq(200)
expect(json.dig("data", 0, "attributes")).to_not have_key("agency")
end
end

describe "GET /dois with client-type filter", prefix_pool_size: 3 do
let!(:dois) { create_list(:doi, 10, client: client, aasm_state: "findable", version_info: "testtag") }
let(:client_igsn_id_catalog) { create(:client, provider: provider, client_type: "igsnCatalog") }
Expand Down