Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update tests following interest calculation functionality #123

Merged
merged 2 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/models/Household.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export class Household {
affordability: marketPurchase.affordability,
landPriceOrRent: this.property.landPrice,
}),
marketPurchase: this.tenure.marketPurchase
marketPurchase: marketPurchase
});

const fairholdLandRent = new FairholdLandRent({
Expand All @@ -105,7 +105,7 @@ export class Household {
landPriceOrRent: averageRentYearly,
}), // fairhold object

marketPurchase: this.tenure.marketPurchase
marketPurchase: marketPurchase
});

return {
Expand Down
9 changes: 8 additions & 1 deletion app/models/tenure/FairholdLandPurchase.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import { Fairhold } from "../Fairhold";
import { DEFAULT_FORECAST_PARAMETERS, ForecastParameters } from "../ForecastParameters";
import { FairholdLandPurchase } from "./FairholdLandPurchase";
import { MarketPurchase } from "./MarketPurchase"

let tenureFairholdLandPurchase: FairholdLandPurchase;

beforeEach(() => {
// partial MarketPurchase object with only necessary properties for test (instead of mocking a whole MarketPurchase object)
const partialMarketPurchase: Pick<MarketPurchase, 'interestPaid'> = {
interestPaid: 200000,
};

const forecastParameters: ForecastParameters = {
...DEFAULT_FORECAST_PARAMETERS,
};
Expand All @@ -20,7 +26,8 @@ beforeEach(() => {
affordability: 0.2,
landPriceOrRent: 31531.579,
}),
forecastParameters: forecastParameters,
forecastParameters: forecastParameters,
marketPurchase: partialMarketPurchase as MarketPurchase
});
});

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

let tenureFairholdLandRent: FairholdLandRent;

beforeEach(() => {
// partial MarketPurchase object with only necessary properties for test (instead of mocking a whole MarketPurchase object)
const partialMarketPurchase: Pick<MarketPurchase, 'interestPaid'> = {
interestPaid: 200000,
};

const forecastParameters: ForecastParameters = {
...DEFAULT_FORECAST_PARAMETERS,
};
Expand All @@ -22,7 +28,8 @@ beforeEach(() => {
landPriceOrRent: 20000,
}),
forecastParameters: forecastParameters,
});
marketPurchase: partialMarketPurchase as MarketPurchase
})
});

it("can be instantiated", () => {
Expand Down