Skip to content

Commit

Permalink
Test that out of bounds ranges do not result in error
Browse files Browse the repository at this point in the history
One test applying to formerly without tests #294.

In process, I realize that the values displayed in the "constraint" aren't clamped, so that'd be an area of improvement -- but I'm not too worried about it, I don't personally have a use case for it. The main thing is ensuring this bad data doesn't result in an uncaught exception, which this regression test now does.
  • Loading branch information
jrochkind committed Dec 2, 2024
1 parent dac0a60 commit 35646d7
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions spec/requests/bad_param_requests_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,20 @@
expect(response.code).to eq("200")
expect(parsed_body.css("span.applied-filter")).not_to be_present
end

describe "out of bounds range config" do
let(:max) { BlacklightRangeLimit.default_range_config[:range_config][:max_value] }
let(:min) { BlacklightRangeLimit.default_range_config[:range_config][:min_value] }

let(:too_high) { max.abs * 2 }
let(:too_low) { min.abs * -2 }

it "does not error" do
get "/catalog?#{ {"range"=>{ range_facet_field => {"begin"=> too_low, "end"=> too_high }}}.to_param }"

expect(response.code).to eq("200")
expect(parsed_body.css("span.applied-filter")).to be_present
end
end
end
end

0 comments on commit 35646d7

Please sign in to comment.