Skip to content

Commit

Permalink
chore: passed ForecastParameters to tenure tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zz-hh-aa committed Aug 16, 2024
1 parent b452722 commit 946f669
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 30 deletions.
8 changes: 6 additions & 2 deletions app/models/tenure/FairholdLandPurchase.test.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
import { Fairhold } from "../Fairhold";
import { DEFAULT_FORECAST_PARAMETERS } from "../ForecastParameters";
import { DEFAULT_FORECAST_PARAMETERS, ForecastParameters } from "../ForecastParameters";
import { FairholdLandPurchase } from "./FairholdLandPurchase";

let tenureFairholdLandPurchase: FairholdLandPurchase;

beforeEach(() => {
const forecastParameters: ForecastParameters = {
...DEFAULT_FORECAST_PARAMETERS,
};

tenureFairholdLandPurchase = new FairholdLandPurchase({
//incomeYearly: 45816,
//averagePrice: 218091.58,
newBuildPrice: 186560,
depreciatedBuildPrice: 110717.45,
//landPrice: 31531.579,
...DEFAULT_FORECAST_PARAMETERS,
affordability: 0.2,
fairhold: new Fairhold({
affordability: 0.2,
landPriceOrRent: 31531.579,
}),
forecastParameters: forecastParameters,
});
});

Expand Down
7 changes: 6 additions & 1 deletion app/models/tenure/FairholdLandRent.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import { Fairhold } from "../Fairhold";
import { DEFAULT_FORECAST_PARAMETERS } from "../ForecastParameters";
import { DEFAULT_FORECAST_PARAMETERS, ForecastParameters } from "../ForecastParameters";
import { FairholdLandRent } from "./FairholdLandRent";

let tenureFairholdLandRent: FairholdLandRent;

beforeEach(() => {
const forecastParameters: ForecastParameters = {
...DEFAULT_FORECAST_PARAMETERS,
};

tenureFairholdLandRent = new FairholdLandRent({
averageRentYearly: 20000,
incomeYearly: 45816,
Expand All @@ -17,6 +21,7 @@ beforeEach(() => {
affordability: 0.2,
landPriceOrRent: 20000,
}),
forecastParameters: forecastParameters,
});
});

Expand Down
17 changes: 4 additions & 13 deletions app/models/tenure/MarketPurchase.test.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
import { MarketPurchase } from "./MarketPurchase";
import { DEFAULT_FORECAST_PARAMETERS, ForecastParameters } from "../ForecastParameters";

let tenureMarketPurchase: MarketPurchase;

beforeEach(() => {
const forecastParameters = {
maintenanceCostPercentage: 0.0125, // percentage maintenance cost
incomeGrowthPerYear: 0.04, // 4% income growth per year
constructionPriceGrowthPerYear: 0.025, // 2.5%
rentGrowthPerYear: 0.03, // 3%
propertyPriceGrowthPerYear: 0.05, // 5%
yearsForecast: 40, // 40 years
affordabilityThresholdIncomePercentage: 0.35, // percentage of imcome to afford rent or purchase
const forecastParameters: ForecastParameters = {
...DEFAULT_FORECAST_PARAMETERS,
};

tenureMarketPurchase = new MarketPurchase({
Expand All @@ -19,11 +14,7 @@ beforeEach(() => {
newBuildPrice: 186560,
depreciatedBuildPrice: 110717.45,
landPrice: 31531.579,
propertyPriceGrowthPerYear: forecastParameters.propertyPriceGrowthPerYear,
constructionPriceGrowthPerYear:
forecastParameters.constructionPriceGrowthPerYear,
yearsForecast: forecastParameters.yearsForecast,
maintenanceCostPercentage: forecastParameters.maintenanceCostPercentage,
forecastParameters: forecastParameters,
});
});

Expand Down
18 changes: 4 additions & 14 deletions app/models/tenure/MarketRent.test.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
import { MarketRent } from "./MarketRent";
import { DEFAULT_FORECAST_PARAMETERS, ForecastParameters } from "../ForecastParameters";

let tenureMarketRent: MarketRent;

beforeEach(() => {
const forecastParameters = {
maintenanceCostPercentage: 0.0125, // percentage maintenance cost
incomeGrowthPerYear: 0.04, // 4% income growth per year
constructionPriceGrowthPerYear: 0.025, // 2.5%
rentGrowthPerYear: 0.03, // 3%
propertyPriceGrowthPerYear: 0.05, // 5%
yearsForecast: 40, // 40 years
affordabilityThresholdIncomePercentage: 0.35, // percentage of imcome to afford rent or purchase
const forecastParameters: ForecastParameters = {
...DEFAULT_FORECAST_PARAMETERS,
};

tenureMarketRent = new MarketRent({
Expand All @@ -20,12 +15,7 @@ beforeEach(() => {
newBuildPrice: 186560,
depreciatedBuildPrice: 110717.45,
landPrice: 31531.579,
propertyPriceGrowthPerYear: forecastParameters.propertyPriceGrowthPerYear,
constructionPriceGrowthPerYear:
forecastParameters.constructionPriceGrowthPerYear,
yearsForecast: forecastParameters.yearsForecast,
maintenanceCostPercentage: forecastParameters.maintenanceCostPercentage,
rentGrowthPerYear: forecastParameters.rentGrowthPerYear,
forecastParameters: forecastParameters,
});
});

Expand Down

0 comments on commit 946f669

Please sign in to comment.