Browse Source

feat: update tests

pull/2278/head
natdeanlewissoftwire 2 years ago
parent
commit
b20e618f2f
  1. 2
      app/services/bulk_upload/lettings/year2024/row_parser.rb
  2. 2
      app/services/bulk_upload/sales/year2024/row_parser.rb
  3. 4
      spec/models/form/lettings/questions/uprn_selection_spec.rb
  4. 4
      spec/models/form/sales/questions/uprn_selection_spec.rb

2
app/services/bulk_upload/lettings/year2024/row_parser.rb

@ -1229,7 +1229,7 @@ private
attributes["county"] = field_20
attributes["address_line1_input"] = address_line1_input
attributes["postcode_full_input"] = postcode_full
attributes["select_best_address_match"] = true
attributes["select_best_address_match"] = true if field_16.blank?
attributes
end

2
app/services/bulk_upload/sales/year2024/row_parser.rb

@ -944,7 +944,7 @@ private
attributes["county"] = field_26
attributes["address_line1_input"] = address_line1_input
attributes["postcode_full_input"] = postcode_full
attributes["select_best_address_match"] = true
attributes["select_best_address_match"] = true if field_22.blank?
attributes["ethnic_group2"] = infer_buyer2_ethnic_group_from_ethnic
attributes["ethnicbuy2"] = field_40

4
spec/models/form/lettings/questions/uprn_selection_spec.rb

@ -60,14 +60,14 @@ RSpec.describe Form::Lettings::Questions::UprnSelection, type: :model do
stub_request(:get, /api.os.uk/)
.to_return(status: 200, body: "", headers: {})
expect(question.answer_options(log)).to eq({ "100" => { "value" => "The address is not listed, I want to enter the address manually" }, "0" => { "value" => "full address" }, "divider" => { "value" => true } })
expect(question.answer_options(log)).to eq({ "uprn_not_listed" => { "value" => "The address is not listed, I want to enter the address manually" }, "UPRN" => { "value" => "full address" }, "divider" => { "value" => true } })
end
it "has the correct displayed answer options" do
stub_request(:get, /api.os.uk/)
.to_return(status: 200, body: "", headers: {})
expect(question.displayed_answer_options(log)).to eq({ "100" => { "value" => "The address is not listed, I want to enter the address manually" }, "0" => { "value" => "full address" }, "divider" => { "value" => true } })
expect(question.displayed_answer_options(log)).to eq({ "uprn_not_listed" => { "value" => "The address is not listed, I want to enter the address manually" }, "UPRN" => { "value" => "full address" }, "divider" => { "value" => true } })
end
it "has the correct inferred check answers value" do

4
spec/models/form/sales/questions/uprn_selection_spec.rb

@ -60,14 +60,14 @@ RSpec.describe Form::Sales::Questions::UprnSelection, type: :model do
stub_request(:get, /api.os.uk/)
.to_return(status: 200, body: "", headers: {})
expect(question.answer_options(log)).to eq({ "100" => { "value" => "The address is not listed, I want to enter the address manually" }, "0" => { "value" => "full address" }, "divider" => { "value" => true } })
expect(question.answer_options(log)).to eq({ "uprn_not_listed" => { "value" => "The address is not listed, I want to enter the address manually" }, "UPRN" => { "value" => "full address" }, "divider" => { "value" => true } })
end
it "has the correct displayed answer options" do
stub_request(:get, /api.os.uk/)
.to_return(status: 200, body: "", headers: {})
expect(question.displayed_answer_options(log)).to eq({ "100" => { "value" => "The address is not listed, I want to enter the address manually" }, "0" => { "value" => "full address" }, "divider" => { "value" => true } })
expect(question.displayed_answer_options(log)).to eq({ "uprn_not_listed" => { "value" => "The address is not listed, I want to enter the address manually" }, "UPRN" => { "value" => "full address" }, "divider" => { "value" => true } })
end
it "has the correct inferred check answers value" do

Loading…
Cancel
Save