Skip to content
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
1 change: 1 addition & 0 deletions src/account/i-user-goal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export interface IUserGoal {
/**
* method used to help determine if you have met your expenses
* @param today
* @param properties
*/
metMonthlyGoal(today: Date, properties: IRentalPropertyEntity[]): boolean;
}
2 changes: 1 addition & 1 deletion src/time/movement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export function movement(options: ILoopOptions, user: IUser): ITimeline {
} while (
!options.hasMetGoalOrMaxTime(
result.startDate,
result.endDate,
cloneDateUtc(result.user.ledgerCollection.getLatestLedgerItem().created),
result.user,
result.rentals.map((x) => x.property).filter((x) => x.isOwned),
options.maxYears
Expand Down
12 changes: 11 additions & 1 deletion tests_int/simulate.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('simulate integration tests', () => {
propertyType: PropertyType.SingleFamily,
},
],
maxYears: 1,
maxYears: 2,
generatorOptionsSingleFamily: {
highestMinSellInYears: 1,
lowestMinSellInYears: 1,
Expand Down Expand Up @@ -79,6 +79,16 @@ describe('simulate integration tests', () => {
})
);

console.table(
actual.rentals
.filter((x) => x.reasons.length > 0)
.map((x) => ({
address: x.property.address,
type: PropertyType[x.property.propertyType],
reasons: JSON.stringify(x.reasons),
}))
);

expect(actual.getEstimatedMonthlyCashFlow()).toBeGreaterThan(0);
expect(actual.endDate).toEqual(cloneDateUtc(actual.user.ledgerCollection.getLatestLedgerItem().created));
expect(actual.startDate).not.toBeNull();
Expand Down