Browse Source

CLDC-2447 Bulk upload 23-24 lettings net income known bug (#1695)

* feat: fix bug

* feat: update tests

* feat: test ALL possibilities
pull/1708/head
natdeanlewissoftwire 2 years ago committed by GitHub
parent
commit
7bfe3f4d75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/services/bulk_upload/lettings/year2023/row_parser.rb
  2. 32
      spec/services/bulk_upload/lettings/year2022/row_parser_spec.rb
  3. 24
      spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb

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

@ -1442,8 +1442,6 @@ private
when 2 when 2
1 1
when 3 when 3
1
when 4
2 2
end end
end end

32
spec/services/bulk_upload/lettings/year2022/row_parser_spec.rb

@ -1295,10 +1295,36 @@ RSpec.describe BulkUpload::Lettings::Year2022::RowParser do
end end
describe "#net_income_known" do describe "#net_income_known" do
let(:attributes) { { bulk_upload:, field_51: "1" } } context "when 1" do
let(:attributes) { { bulk_upload:, field_51: "1" } }
it "sets value from correct mapping" do it "sets value from correct mapping" do
expect(parser.log.net_income_known).to eq(0) expect(parser.log.net_income_known).to eq(0)
end
end
context "when 2" do
let(:attributes) { { bulk_upload:, field_51: "2" } }
it "sets value from correct mapping" do
expect(parser.log.net_income_known).to eq(1)
end
end
context "when 3" do
let(:attributes) { { bulk_upload:, field_51: "3" } }
it "sets value from correct mapping" do
expect(parser.log.net_income_known).to eq(1)
end
end
context "when 4" do
let(:attributes) { { bulk_upload:, field_51: "4" } }
it "sets value from correct mapping" do
expect(parser.log.net_income_known).to eq(2)
end
end end
end end

24
spec/services/bulk_upload/lettings/year2023/row_parser_spec.rb

@ -1365,10 +1365,28 @@ RSpec.describe BulkUpload::Lettings::Year2023::RowParser do
end end
describe "#net_income_known" do describe "#net_income_known" do
let(:attributes) { { bulk_upload:, field_120: "1" } } context "when 1" do
let(:attributes) { { bulk_upload:, field_120: "1" } }
it "sets value from correct mapping" do it "sets value from correct mapping" do
expect(parser.log.net_income_known).to eq(0) expect(parser.log.net_income_known).to eq(0)
end
end
context "when 2" do
let(:attributes) { { bulk_upload:, field_120: "2" } }
it "sets value from correct mapping" do
expect(parser.log.net_income_known).to eq(1)
end
end
context "when 3" do
let(:attributes) { { bulk_upload:, field_120: "3" } }
it "sets value from correct mapping" do
expect(parser.log.net_income_known).to eq(2)
end
end end
end end

Loading…
Cancel
Save