diff --git a/app/services/bulk_upload/sales/year2023/row_parser.rb b/app/services/bulk_upload/sales/year2023/row_parser.rb index 11cd9f9a7..62598c5ad 100644 --- a/app/services/bulk_upload/sales/year2023/row_parser.rb +++ b/app/services/bulk_upload/sales/year2023/row_parser.rb @@ -823,6 +823,7 @@ private attributes["mortgageused"] = mortgageused attributes["uprn"] = field_19 + attributes["uprn_known"] = field_19.present? ? 1 : 0 attributes["address_line1"] = field_20 attributes["address_line2"] = field_21 attributes["town_or_city"] = field_22 diff --git a/spec/services/bulk_upload/sales/year2023/row_parser_spec.rb b/spec/services/bulk_upload/sales/year2023/row_parser_spec.rb index 8c5b899b9..3e6413be7 100644 --- a/spec/services/bulk_upload/sales/year2023/row_parser_spec.rb +++ b/spec/services/bulk_upload/sales/year2023/row_parser_spec.rb @@ -662,6 +662,24 @@ RSpec.describe BulkUpload::Sales::Year2023::RowParser do end end + describe "#uprn_known" do + context "when uprn known" do + let(:attributes) { setup_section_params.merge({ field_19: "100023336956" }) } + + it "is correctly set" do + expect(parser.log.uprn_known).to be(1) + end + end + + context "when uprn not known" do + let(:attributes) { setup_section_params.merge({ field_19: nil }) } + + it "is correctly set" do + expect(parser.log.uprn_known).to be(0) + end + end + end + describe "#address_line1" do let(:attributes) { setup_section_params.merge({ field_20: "some street" }) }