Skip to content

Commit

Permalink
Merge pull request Expensify#38736 from margelo/perunt/reassure
Browse files Browse the repository at this point in the history
[NO QA] Reassure fix
  • Loading branch information
amyevans authored Mar 21, 2024
2 parents 2f2dc5d + 3d5b6b3 commit 553529d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
7 changes: 5 additions & 2 deletions tests/utils/LHNTestUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,14 @@ function getFakeReport(participantAccountIDs = [1, 2], millisecondsInThePast = 0
function getFakeReportAction(actor = '[email protected]', millisecondsInThePast = 0): ReportAction {
const timestamp = Date.now() - millisecondsInThePast;
const created = DateUtils.getDBTime(timestamp);
const previousReportActionID = lastFakeReportActionID;
const reportActionID = ++lastFakeReportActionID;

return {
actor,
actorAccountID: 1,
reportActionID: `${++lastFakeReportActionID}`,
reportActionID: `${reportActionID}`,
previousReportActionID: `${previousReportActionID}`,
actionName: CONST.REPORT.ACTIONS.TYPE.CREATED,
shouldShow: true,
created,
Expand Down Expand Up @@ -183,7 +186,7 @@ function getFakeReportAction(actor = '[email protected]', millisecondsInThePast =
},
],
originalMessage: {
childReportID: `${++lastFakeReportActionID}`,
childReportID: `${reportActionID}`,
emojiReactions: {
heart: {
createdAt: '2023-08-28 15:27:52',
Expand Down
9 changes: 7 additions & 2 deletions tests/utils/ReportTestUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,20 @@ const getFakeReportAction = (index: number, actionName?: ActionName): ReportActi
text: '[email protected]',
},
],
previousReportActionID: '1',
reportActionID: index.toString(),
previousReportActionID: (index === 0 ? 0 : index - 1).toString(),
reportActionTimestamp: 1696243169753,
sequenceNumber: 0,
shouldShow: true,
timestamp: 1696243169,
whisperedToAccountIDs: [],
} as ReportAction);

const getMockedSortedReportActions = (length = 100): ReportAction[] => Array.from({length}, (element, index): ReportAction => getFakeReportAction(index));
const getMockedSortedReportActions = (length = 100): ReportAction[] =>
Array.from({length}, (element, index): ReportAction => {
const actionName: ActionName = index === 0 ? 'CREATED' : 'ADDCOMMENT';
return getFakeReportAction(index + 1, actionName);
}).reverse();

const getMockedReportActionsMap = (length = 100): ReportActions => {
const mockReports: ReportActions[] = Array.from({length}, (element, index): ReportActions => {
Expand All @@ -60,6 +64,7 @@ const getMockedReportActionsMap = (length = 100): ReportActions => {
originalMessage: {
linkedReportID: reportID.toString(),
},
previousReportActionID: index.toString(),
} as ReportAction;

return {[reportID]: reportAction};
Expand Down
2 changes: 1 addition & 1 deletion tests/utils/collections/reportActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default function createRandomReportAction(index: number): ReportAction {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
actionName: rand(flattenActionNamesValues(CONST.REPORT.ACTIONS.TYPE)) as any,
reportActionID: index.toString(),
previousReportActionID: index.toString(),
previousReportActionID: (index === 0 ? 0 : index - 1).toString(),
actorAccountID: index,
person: [
{
Expand Down

0 comments on commit 553529d

Please sign in to comment.