From 6f3294be8ca1155459617a2d5e18a3bb02a0338a Mon Sep 17 00:00:00 2001 From: natdeanlewissoftwire Date: Wed, 13 Mar 2024 17:03:32 +0000 Subject: [PATCH] feat: add test --- .../bulk_upload/sales/year2024/row_parser_spec.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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 ce81300b5..5795b01d5 100644 --- a/spec/services/bulk_upload/sales/year2024/row_parser_spec.rb +++ b/spec/services/bulk_upload/sales/year2024/row_parser_spec.rb @@ -1038,6 +1038,20 @@ RSpec.describe BulkUpload::Sales::Year2024::RowParser do end end + describe "#field_117" do + context "when validate_discounted_ownership_value is triggered" do + let(:attributes) { setup_section_params.merge(field_114: 100, field_123: 100, field_8: 2, field_10: 9, field_117: 2, field_116: 10) } + + # value = 100, deposit = 100, mortgage = 100, discount = 10% + + it "only adds errors to the discounted ownership field" do + expect(parser.errors[:field_103]).to be_empty + expect(parser.errors[:field_117]).to include("The mortgage, deposit, and grant when added together is £100.00, and the purchase purchase price times by the discount is £90.00. These figures should be the same") + expect(parser.errors[:field_126]).to be_empty + end + end + end + describe "soft validations" do context "when soft validation is triggered" do let(:attributes) { valid_attributes.merge({ field_31: 22, field_35: 5 }) }