-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Fix all offline created transaction is deleted when we delete one of the transaction #27306
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
Changes from all commits
cff45ee
d7a37cd
702c960
9548e2a
70e7830
df77b50
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -106,7 +106,7 @@ describe('actions/IOU', () => { | |
| iouAction = iouActions[0]; | ||
|
|
||
| // The CREATED action should not be created after the IOU action | ||
| expect(Date.parse(createdAction.created)).toBeLessThanOrEqual(Date.parse(iouAction.created)); | ||
| expect(Date.parse(createdAction.created)).toBeLessThan(Date.parse(iouAction.created)); | ||
|
|
||
| // The IOUReportID should be correct | ||
| expect(iouAction.originalMessage.IOUReportID).toBe(iouReportID); | ||
|
|
@@ -213,6 +213,7 @@ describe('actions/IOU', () => { | |
| }; | ||
| let iouReportID; | ||
| let iouAction; | ||
| let iouCreatedAction; | ||
| let transactionID; | ||
| fetch.pause(); | ||
| return Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${chatReport.reportID}`, chatReport) | ||
|
|
@@ -261,10 +262,11 @@ describe('actions/IOU', () => { | |
|
|
||
| // The chat report should have a CREATED and an IOU action | ||
| expect(_.size(allIOUReportActions)).toBe(2); | ||
| iouCreatedAction = _.find(allIOUReportActions, (reportAction) => reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.CREATED); | ||
| iouAction = _.find(allIOUReportActions, (reportAction) => reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.IOU); | ||
|
|
||
| // The CREATED action should not be created after the IOU action | ||
| expect(Date.parse(createdAction.created)).toBeLessThanOrEqual(Date.parse(iouAction.created)); | ||
| expect(Date.parse(iouCreatedAction.created)).toBeLessThan(Date.parse(iouAction.created)); | ||
|
|
||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I changed it from |
||
| // The IOUReportID should be correct | ||
| expect(iouAction.originalMessage.IOUReportID).toBe(iouReportID); | ||
|
|
@@ -598,7 +600,7 @@ describe('actions/IOU', () => { | |
| iouAction = iouActions[0]; | ||
|
|
||
| // The CREATED action should not be created after the IOU action | ||
| expect(Date.parse(createdAction.created)).toBeLessThanOrEqual(Date.parse(iouAction.created)); | ||
| expect(Date.parse(createdAction.created)).toBeLessThan(Date.parse(iouAction.created)); | ||
|
|
||
| // The IOUReportID should be correct | ||
| expect(iouAction.originalMessage.IOUReportID).toBe(iouReportID); | ||
|
|
@@ -865,9 +867,11 @@ describe('actions/IOU', () => { | |
|
|
||
| let carlosIOUReport; | ||
| let carlosIOUAction; | ||
| let carlosIOUCreatedAction; | ||
| let carlosTransaction; | ||
|
|
||
| let julesIOUAction; | ||
| let julesIOUCreatedAction; | ||
| let julesTransaction; | ||
|
|
||
| let vitChatReport; | ||
|
|
@@ -1010,17 +1014,19 @@ describe('actions/IOU', () => { | |
|
|
||
| // Carlos DM should have two reportActions – the existing CREATED action and a pending IOU action | ||
| expect(_.size(carlosReportActions)).toBe(2); | ||
| carlosIOUCreatedAction = _.find(carlosReportActions, (reportAction) => reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.CREATED); | ||
| carlosIOUAction = _.find(carlosReportActions, (reportAction) => reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.IOU); | ||
| expect(carlosIOUAction.pendingAction).toBe(CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD); | ||
| expect(carlosIOUAction.originalMessage.IOUReportID).toBe(carlosIOUReport.reportID); | ||
| expect(carlosIOUAction.originalMessage.amount).toBe(amount / 4); | ||
| expect(carlosIOUAction.originalMessage.comment).toBe(comment); | ||
| expect(carlosIOUAction.originalMessage.type).toBe(CONST.IOU.REPORT_ACTION_TYPE.CREATE); | ||
| expect(Date.parse(carlosCreatedAction.created)).toBeLessThanOrEqual(Date.parse(carlosIOUAction.created)); | ||
| expect(Date.parse(carlosIOUCreatedAction.created)).toBeLessThan(Date.parse(carlosIOUAction.created)); | ||
|
|
||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same reason as above |
||
| // Jules DM should have three reportActions, the existing CREATED action, the existing IOU action, and a new pending IOU action | ||
| expect(_.size(julesReportActions)).toBe(3); | ||
| expect(julesReportActions[julesCreatedAction.reportActionID]).toStrictEqual(julesCreatedAction); | ||
| julesIOUCreatedAction = _.find(julesReportActions, (reportAction) => reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.CREATED); | ||
| julesIOUAction = _.find( | ||
| julesReportActions, | ||
| (reportAction) => | ||
|
|
@@ -1031,7 +1037,7 @@ describe('actions/IOU', () => { | |
| expect(julesIOUAction.originalMessage.amount).toBe(amount / 4); | ||
| expect(julesIOUAction.originalMessage.comment).toBe(comment); | ||
| expect(julesIOUAction.originalMessage.type).toBe(CONST.IOU.REPORT_ACTION_TYPE.CREATE); | ||
| expect(Date.parse(julesCreatedAction.created)).toBeLessThanOrEqual(Date.parse(julesIOUAction.created)); | ||
| expect(Date.parse(julesIOUCreatedAction.created)).toBeLessThan(Date.parse(julesIOUAction.created)); | ||
|
|
||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same reason as above |
||
| // Vit DM should have two reportActions – a pending CREATED action and a pending IOU action | ||
| expect(_.size(vitReportActions)).toBe(2); | ||
|
|
@@ -1043,7 +1049,7 @@ describe('actions/IOU', () => { | |
| expect(vitIOUAction.originalMessage.amount).toBe(amount / 4); | ||
| expect(vitIOUAction.originalMessage.comment).toBe(comment); | ||
| expect(vitIOUAction.originalMessage.type).toBe(CONST.IOU.REPORT_ACTION_TYPE.CREATE); | ||
| expect(Date.parse(vitCreatedAction.created)).toBeLessThanOrEqual(Date.parse(vitIOUAction.created)); | ||
| expect(Date.parse(vitCreatedAction.created)).toBeLessThan(Date.parse(vitIOUAction.created)); | ||
|
|
||
| // Group chat should have two reportActions – a pending CREATED action and a pending IOU action w/ type SPLIT | ||
| expect(_.size(groupReportActions)).toBe(2); | ||
|
|
||
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.
Fortunately we already have the unit test, but it uses
toBeLessThanOrEqual, so I changed it totoBeLessThan.