Skip to content

Commit

Permalink
Remove depreciated Hyrax::SolrQueryBuilderService from tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rawOrlando committed Nov 29, 2023
1 parent e6378d4 commit 62e9dae
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion spec/search_builders/hyrax/my/find_works_search_builder_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,35 @@

it "is successful" do
subject
expect(solr_params[:fq]).to eq ["-" + Hyrax::SolrQueryBuilderService.construct_query_for_ids([work.id])]
expect(solr_params[:fq]).to eq ["-" + Hyrax::SolrQueryService.new.with_ids(ids: [work.id]).build]
end
end

describe "#show_only_works_not_child" do
subject { builder.show_only_works_not_child(solr_params) }

it "is successful" do
subject
ids = Hyrax::SolrService.query("{!field f=id}#{work.id}", fl: "member_ids_ssim").flat_map { |x| x.fetch("member_ids_ssim", []) }
expect(solr_params[:fq]).to eq ["-" + Hyrax::SolrQueryService.new.with_ids(ids: [ids]).build]
end

it "is successful old way" do
subject
ids = Hyrax::SolrService.query("{!field f=id}#{work.id}", fl: "member_ids_ssim").flat_map { |x| x.fetch("member_ids_ssim", []) }
expect(solr_params[:fq]).to eq ["-" + Hyrax::SolrQueryBuilderService.construct_query_for_ids([ids])]
end

it "is successful new same code way" do
subject
ids = Hyrax::SolrService.query("{!field f=id}#{work.id}", fl: "member_ids_ssim").flat_map { |x| x.fetch("member_ids_ssim", []) }
ids = [ids]
ids = ids.reject(&:blank?)
if ids.empty?
ids = "id:NEVER_USE_THIS_ID"
end
expect(solr_params[:fq]).to eq ["-" + Hyrax::SolrQueryService.new.with_ids(ids: ids).build]
end
end

describe "#show_only_works_not_parent" do
Expand Down

0 comments on commit 62e9dae

Please sign in to comment.