Skip to content

Commit

Permalink
Adding a test for the advanced search and json dls being on with the …
Browse files Browse the repository at this point in the history
…algortihm swapping

This shows that the other two features take presidence

Co-authored-by: James R. Griffin III <jrgriffiniii@users.noreply.github.com>
  • Loading branch information
carolyncole and jrgriffiniii committed Nov 8, 2023
1 parent d9c8466 commit 403c47f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions spec/requests/request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -566,5 +566,20 @@
expect(json["data"][0]["attributes"]["title"]).to eq "Reconstructing the Vitruvian Scorpio: An Engineering Analysis of Roman Field Artillery"
end
end

context "advanced search and jsonld are enabled" do
before do
allow(Flipflop).to receive(:json_query_dsl?).and_return(true)
allow(Flipflop).to receive(:view_components_advanced_search?).and_return(true)
end

# TODO: what should this really do? Should the advanced search and jsonld get turned off when an algorithm is swapped
# Should we see if we can combine the search handlers by adding a query parameter, or make a combined handler that has both?
it "retuns the jsonld result not the engineering result" do
get "/catalog.json?utf8=%E2%9C%93&clause%5B0%5D%5Bfield%5D=all_fields&clause%5B0%5D%5Bquery%5D=roman&clause%5B1%5D%5Bop%5D=must&clause%5B1%5D%5Bfield%5D=author&clause%5B1%5D%5Bquery%5D=&clause%5B2%5D%5Bop%5D=must&clause%5B2%5D%5Bfield%5D=title&clause%5B2%5D%5Bquery%5D=&range%5Bpub_date_start_sort%5D%5Bbegin%5D=&range%5Bpub_date_start_sort%5D%5Bend%5D=&sort=score+desc%2C+pub_date_start_sort+desc%2C+title_sort+asc&commit=Search&search_algorithm=engineering"
json = JSON.parse(response.body)
expect(json["data"][0]["attributes"]["title"]).to eq "Ogonek : roman / ."
end
end
end
end

0 comments on commit 403c47f

Please sign in to comment.