Skip to content

Commit

Permalink
add spec for agency in dois search response
Browse files Browse the repository at this point in the history
  • Loading branch information
bklaing2 committed Nov 20, 2024
1 parent fdf9ec8 commit 9555997
Showing 1 changed file with 23 additions and 0 deletions.
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

0 comments on commit 9555997

Please sign in to comment.