-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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 negative amount #51122
fix negative amount #51122
Conversation
@hungvu193 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
Little update: |
Got this issue while testing however I can't reproduce it consistently Screen.Recording.2024-10-25.at.14.54.32.mov |
Reviewer Checklist
Screenshots/VideosAndroid: NativeUploading Screen Recording 2024-10-25 at 16.21.10.mov… Android: mWeb ChromeScreen.Recording.2024-10-25.at.16.21.10.moviOS: NativeScreen.Recording.2024-10-25.at.16.02.41.moviOS: mWeb SafariScreen.Recording.2024-10-25.at.16.11.59.movMacOS: Chrome / SafariScreen.Recording.2024-10-25.at.15.20.02.movMacOS: DesktopScreen.Recording.2024-10-25.at.15.26.37.mov |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests well!
@Nodebrute could we add a jest test so that we make sure this issue doesn't regress in the future? |
@Nodebrute friendly bump on this comment. |
Will update this in a few hours. |
@hungvu193 Can you help me with the tests here, TIA! |
How about this? describe('Check valid amout for IOU/Expense request', () => {
test('IOU amount should be positive', () => {
const iouReport = ReportUtils.buildOptimisticIOUReport(1, 2, 100, '1', 'USD');
const iouTransaction = TransactionUtils.buildOptimisticTransaction(100, 'USD', iouReport.reportID);
const iouAmount = TransactionUtils.getAmount(iouTransaction, false, false);
expect(iouAmount).toBeGreaterThan(0);
});
test('Expense amount should be negative', () => {
const expenseReport = ReportUtils.buildOptimisticExpenseReport('212', '123', 100, 122, 'USD');
const expenseTransaction = TransactionUtils.buildOptimisticTransaction(100, 'USD', expenseReport.reportID);
const expenseAmount = TransactionUtils.getAmount(expenseTransaction, true, false);
expect(expenseAmount).toBeLessThan(0);
});
}); Result: Any thoughts? @blimpich |
Thanks @hungvu193. |
Looks good to me! Thank you! |
@Nodebrute can we add those tests to the PR? |
I've added the tests! Thanks again, @hungvu193, for the help. @blimpich, it's all yours now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small typo, fix that and we're good to go!
tests/unit/IOUUtilsTest.ts
Outdated
@@ -146,3 +146,19 @@ describe('isValidMoneyRequestType', () => { | |||
expect(IOUUtils.isValidMoneyRequestType('money')).toBe(false); | |||
}); | |||
}); | |||
|
|||
describe('Check valid amout for IOU/Expense request', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
describe('Check valid amout for IOU/Expense request', () => { | |
describe('Check valid amount for IOU/Expense request', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/blimpich in version: 9.0.56-0 🚀
|
Details
Fixed Issues
$ #49754
PROPOSAL: #49754 (comment)
Tests
[User A] Submit two expenses to User B.
[User A] Hold one of the expenses.
[User B] Go offline.
[User B] Pay the unheld expense.
[User B] Click on the expense preview of the held expense in the main chat.
[User B] Verify the amount in the transaction thread will not be negative.
Offline tests
Same as above
QA Steps
[User A] Submit two expenses to User B.
[User A] Hold one of the expenses.
[User B] Go offline.
[User B] Pay the unheld expense.
[User B] Click on the expense preview of the held expense in the main chat.
[User B] Verify the amount in the transaction thread will not be negative.
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Screen.Recording.2024-10-19.at.9.01.49.PM.mov
Android: mWeb Chrome
Screen.Recording.2024-10-19.at.9.05.10.PM.mov
iOS: Native
Screen.Recording.2024-10-19.at.8.32.45.PM.mov
iOS: mWeb Safari
Screen.Recording.2024-10-19.at.8.30.05.PM.mov
MacOS: Chrome / Safari
Screen.Recording.2024-10-19.at.8.15.17.PM.mov
MacOS: Desktop
Screen.Recording.2024-10-19.at.8.23.01.PM.mov