Skip to content

handle negative amounts in calculate rate correctly#14

Merged
SharonGrossman merged 2 commits intomainfrom
handle-negative-amounts-in-rate
Apr 17, 2025
Merged

handle negative amounts in calculate rate correctly#14
SharonGrossman merged 2 commits intomainfrom
handle-negative-amounts-in-rate

Conversation

@SharonGrossman
Copy link
Copy Markdown
Contributor

No description provided.

@SharonGrossman SharonGrossman requested review from danielwitz and noamokman and removed request for noamokman April 17, 2025 10:45
Comment thread tests/main.spec.ts Outdated
Comment on lines +282 to +283
expect(calculateRate({ value: -1000, currency: 'USD' }, { value: -800, currency: 'EUR' })).toBe(0.8);
expect(calculateRate({ value: -1000, currency: 'USD' }, { value: -1000, currency: 'GBP' })).toBe(1);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

pretty sure these worked before

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

if you changed apply rate you should add tests for those cases in the apply rates function tests

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

if only one of the amounts is negative, it's coming out negative
also - fixed, my bad, i altered the apply rate and not the calculate rate

@SharonGrossman SharonGrossman merged commit 2f5cbac into main Apr 17, 2025
3 checks passed
@SharonGrossman SharonGrossman deleted the handle-negative-amounts-in-rate branch April 17, 2025 11:07
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.

3 participants