CLDC-3338: Add tolerance to discounted sale calculations (#2333)
* Rename method
* Update staircase/non staircase validations
* Add errors to type
* Remove validate_shared_ownership_deposit
* Don't add setup BU errors, deduplicate different sale type errors
* Add tolerance
* Reuse method
* Rename methods
* Skip type error completely in BU
* Update validation messages
* Update over tolerance method
* C:DC-3338: Add tolerance to grant calculations
---------
Co-authored-by: Kat <katrina@kosiak.co.uk>
pull/2341/head
Robert Sullivan9 months agocommitted bynatdeanlewissoftwire
expect(record.errors["mortgageused"]).toinclude("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase purchase price times by the discount is £49,999.00. These figures should be the same")
expect(record.errors["mortgage"]).toinclude("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase purchase price times by the discount is £49,999.00. These figures should be the same")
expect(record.errors["value"]).toinclude("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase purchase price times by the discount is £49,999.00. These figures should be the same")
expect(record.errors["deposit"]).toinclude("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase purchase price times by the discount is £49,999.00. These figures should be the same")
expect(record.errors["ownershipsch"]).toinclude("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase purchase price times by the discount is £49,999.00. These figures should be the same")
expect(record.errors["discount"]).toinclude("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase purchase price times by the discount is £49,999.00. These figures should be the same")
expect(record.errors["grant"]).toinclude("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase purchase price times by the discount is £49,999.00. These figures should be the same")
end
it"adds an error if mortgage, deposit and grant at least 1 less than discounted value"do
expect(record.errors["mortgageused"]).toinclude("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase purchase price times by the discount is £50,001.00. These figures should be the same")
expect(record.errors["mortgage"]).toinclude("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase purchase price times by the discount is £50,001.00. These figures should be the same")
expect(record.errors["value"]).toinclude("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase purchase price times by the discount is £50,001.00. These figures should be the same")
expect(record.errors["deposit"]).toinclude("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase purchase price times by the discount is £50,001.00. These figures should be the same")
expect(record.errors["ownershipsch"]).toinclude("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase purchase price times by the discount is £50,001.00. These figures should be the same")
expect(record.errors["discount"]).toinclude("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase purchase price times by the discount is £50,001.00. These figures should be the same")
expect(record.errors["grant"]).toinclude("The mortgage, deposit, and grant when added together is £50,000.00, and the purchase purchase price times by the discount is £50,001.00. These figures should be the same")
end
it"does not add an error if mortgage, deposit and grant less than 1 greater than discounted value"do
expect(record.errors["mortgageused"]).toinclude("The mortgage, deposit, and grant when added together is £18,000.00, and the purchase purchase price times by the discount is £30,000.00. These figures should be the same")
expect(record.errors["mortgage"]).toinclude("The mortgage, deposit, and grant when added together is £18,000.00, and the purchase purchase price times by the discount is £30,000.00. These figures should be the same")
expect(record.errors["mortgageused"]).tobe_empty
expect(record.errors["value"]).toinclude("The mortgage, deposit, and grant when added together is £18,000.00, and the purchase purchase price times by the discount is £30,000.00. These figures should be the same")
expect(record.errors["mortgage"]).tobe_empty
expect(record.errors["deposit"]).toinclude("The mortgage, deposit, and grant when added together is £18,000.00, and the purchase purchase price times by the discount is £30,000.00. These figures should be the same")
expect(record.errors["value"]).tobe_empty
expect(record.errors["ownershipsch"]).toinclude("The mortgage, deposit, and grant when added together is £18,000.00, and the purchase purchase price times by the discount is £30,000.00. These figures should be the same")
expect(record.errors["deposit"]).tobe_empty
expect(record.errors["discount"]).toinclude("The mortgage, deposit, and grant when added together is £18,000.00, and the purchase purchase price times by the discount is £30,000.00. These figures should be the same")
expect(record.errors["ownershipsch"]).tobe_empty
expect(record.errors["grant"]).toinclude("The mortgage, deposit, and grant when added together is £18,000.00, and the purchase purchase price times by the discount is £30,000.00. These figures should be the same")
expect(record.errors["discount"]).tobe_empty
expect(record.errors["grant"]).tobe_empty
end
end
it"returns false if mortgage, deposit and grant total equals market value"do
it"does not add an error if mortgage, deposit and grant total equals discounted value"do