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

Resolves Add annual adjustments for amountPerAnnum #30 #31

Merged
merged 3 commits into from
Aug 18, 2024

Conversation

mancubus77
Copy link

Resolves #30

Copy link
Owner

@JDIZM JDIZM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution @mancubus77 I just made a small suggestion and can you please run prettier and update the unit tests and maybe add an additional test case. Thanks!

README.md Outdated Show resolved Hide resolved
rate: 7.8,
years: 25,
paymentsPerAnnum: 1,
amountPerAnnum: 12_000,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice thanks for the update! Last request from me and I will get it merged in 😃

With the test we want to test the expected output of amountPerAnnum is correct, so ideally we would want to test it changes to the correct amount after the first year. You can use currentPositionInYears to get the balance for a specific year.

You can do something like this:

const firstYearOptions = { ...initialOptions, currentPositionInYears: 1 };
const secondYearOptions = { ...initialOptions, currentPositionInYears: 2 };

const firstYearResult = compoundInterestPerPeriod(firstYearOptions);
const secondYearResult = compoundInterestPerPeriod(secondYearOptions);

Side note: I think I just spotted a previous bug with accrualOfPaymentsPerAnnum: false where the end balance is not updating correctly. I am going to raise an issue and a pr for this.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually I just realised we don't actually return amountPerAnnum to check the output, should we return this amount so we can see what the final contributions would be further down the line?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am going to approve this and we can add this as an additional feature

@JDIZM JDIZM merged commit dd3ad10 into JDIZM:main Aug 18, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add annual adjustments for amountPerAnnum
2 participants