diff --git a/spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb b/spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb index 939d90297..eb2ad2f6f 100644 --- a/spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb +++ b/spec/services/bulk_upload/lettings/year2024/row_parser_spec.rb @@ -798,6 +798,15 @@ RSpec.describe BulkUpload::Lettings::Year2024::RowParser do expect(parser.errors[:field_43]).to eql(["You must answer lead tenant’s gender identity"]) end end + + context "when other null error is added" do + let(:attributes) { setup_section_params.merge({ field_112: nil }) } + + it "only has one error added to the field" do + parser.valid? + expect(parser.errors[:field_112]).to eql(["You must answer was the letting made under the Choice-Based Lettings (CBL)?"]) + end + end end end diff --git a/spec/services/bulk_upload/sales/year2024/row_parser_spec.rb b/spec/services/bulk_upload/sales/year2024/row_parser_spec.rb index e68e95f06..130af4135 100644 --- a/spec/services/bulk_upload/sales/year2024/row_parser_spec.rb +++ b/spec/services/bulk_upload/sales/year2024/row_parser_spec.rb @@ -282,6 +282,26 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do expect(questions.map(&:id)).to eql([]) end end + + describe "#validate_nulls" do + context "when non-setup questions are null" do + let(:attributes) { setup_section_params.merge({ field_32: "" }) } + + it "fetches the question's check_answer_label if it exists, otherwise it gets the question's header" do + parser.valid? + expect(parser.errors[:field_32]).to eql(["You must answer buyer 1’s gender identity"]) + end + end + + context "when other null error is added" do + let(:attributes) { setup_section_params.merge({ field_23: nil }) } + + it "only has one error added to the field" do + parser.valid? + expect(parser.errors[:field_23]).to eql(["You must answer address line 1"]) + end + end + end end context "when setup section not complete and type is not given" do