Skip to content

Commit

Permalink
fix previousReportActionID for createRandomReportAction, fix getFakeR…
Browse files Browse the repository at this point in the history
…eportAction
  • Loading branch information
perunt committed Mar 21, 2024
1 parent 9e0348a commit 19a6229
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/components/VideoPlayer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ VideoPlayer.displayName = 'VideoPlayer';
VideoPlayer.propTypes = videoPlayerPropTypes;
VideoPlayer.defaultProps = videoPlayerDefaultProps;

export default forwardRef(VideoPlayer);
export default forwardRef(VideoPlayer);
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: (index === 0 ? 0 : index - 1).toString(),
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 @@ -57,6 +61,7 @@ const getMockedReportActionsMap = (length = 100): ReportActions => {
const reportAction = {
...createRandomReportAction(reportID),
actionName,
previousReportActionID: index.toString(),
originalMessage: {
linkedReportID: reportID.toString(),
},
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 19a6229

Please sign in to comment.