From 0832891452629696c17633ab384cddbceee145ce Mon Sep 17 00:00:00 2001 From: zzhhaa Date: Fri, 22 Nov 2024 16:56:30 +0000 Subject: [PATCH] feat: add new test for updated depreciation --- app/models/Property.test.ts | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/app/models/Property.test.ts b/app/models/Property.test.ts index 356a6fcf..b87f7b9f 100644 --- a/app/models/Property.test.ts +++ b/app/models/Property.test.ts @@ -24,8 +24,23 @@ it("correctly calculates the newBuildPrice", () => { expect(property.newBuildPrice).toBeCloseTo(186560); }); -it("correctly calculates the depreciatedBuildPrice", () => { - expect(property.depreciatedBuildPrice).toBeCloseTo(110717.45); +it("correctly calculates the depreciatedBuildPrice for existing builds (age > 0)", () => { + expect(property.depreciatedBuildPrice).toBeCloseTo(172988.92); +}); + +it("correctly calculates depreciatedBuildPrice for newbuilds (age = 0)", () => { + property = new Property({ + postcode: "WV8 1HG", + houseType: "T", + numberOfBedrooms: 2, + age: 1, + size: 88, + maintenancePercentage: 0.02, + newBuildPricePerMetre: 2120, + averageMarketPrice: 218091.58, + itl3: "TLG24", + }); + expect(property.depreciatedBuildPrice).toBeCloseTo(186560) }); it("correctly calculates the bedWeightedAveragePrice", () => {