-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
878fd0f
commit 887b6e6
Showing
4 changed files
with
231 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ import {ActionListContext, ReactionListContext} from '../../src/pages/home/Repor | |
import variables from '../../src/styles/variables'; | ||
import * as LHNTestUtils from '../utils/LHNTestUtils'; | ||
import PusherHelper from '../utils/PusherHelper'; | ||
import * as ReportTestUtils from '../utils/ReportTestUtils'; | ||
import waitForBatchedUpdates from '../utils/waitForBatchedUpdates'; | ||
import wrapOnyxWithWaitForBatchedUpdates from '../utils/wrapOnyxWithWaitForBatchedUpdates'; | ||
|
||
|
@@ -58,7 +59,7 @@ afterAll(() => { | |
|
||
const mockOnLayout = jest.fn(); | ||
const mockOnScroll = jest.fn(); | ||
const mockLoadMoreChats = jest.fn(); | ||
const mockLoadChats = jest.fn(); | ||
const mockRef = {current: null}; | ||
|
||
// Initialize the network key for OfflineWithFeedback | ||
|
@@ -74,49 +75,6 @@ afterEach(() => { | |
PusherHelper.teardown(); | ||
}); | ||
|
||
const getFakeReportAction = (index) => ({ | ||
actionName: 'ADDCOMMENT', | ||
actorAccountID: index, | ||
automatic: false, | ||
avatar: '', | ||
created: '2023-09-12 16:27:35.124', | ||
isAttachment: true, | ||
isFirstItem: false, | ||
lastModified: '2021-07-14T15:00:00Z', | ||
message: [ | ||
{ | ||
html: 'hey', | ||
isDelatedParentAction: false, | ||
isEdited: false, | ||
reactions: [], | ||
text: 'test', | ||
type: 'TEXT', | ||
whisperedTo: [], | ||
}, | ||
], | ||
originalMessage: { | ||
html: 'hey', | ||
lastModified: '2021-07-14T15:00:00Z', | ||
}, | ||
pendingAction: null, | ||
person: [ | ||
{ | ||
type: 'TEXT', | ||
style: 'strong', | ||
text: '[email protected]', | ||
}, | ||
], | ||
previousReportActionID: '1', | ||
reportActionID: index.toString(), | ||
reportActionTimestamp: 1696243169753, | ||
sequenceNumber: 2, | ||
shouldShow: true, | ||
timestamp: 1696243169, | ||
whisperedToAccountIDs: [], | ||
}); | ||
|
||
const getMockedSortedReportActions = (length = 100) => Array.from({length}, (__, i) => getFakeReportAction(i)); | ||
|
||
const currentUserAccountID = 5; | ||
|
||
function ReportActionsListWrapper() { | ||
|
@@ -125,11 +83,13 @@ function ReportActionsListWrapper() { | |
<ReactionListContext.Provider value={mockRef}> | ||
<ActionListContext.Provider value={mockRef}> | ||
<ReportActionsList | ||
sortedReportActions={getMockedSortedReportActions(500)} | ||
sortedReportActions={ReportTestUtils.getMockedSortedReportActions(500)} | ||
report={LHNTestUtils.getFakeReport()} | ||
onLayout={mockOnLayout} | ||
onScroll={mockOnScroll} | ||
loadMoreChats={mockLoadMoreChats} | ||
loadMoreChats={mockLoadChats} | ||
loadOlderChats={mockLoadChats} | ||
loadNewerChats={mockLoadChats} | ||
currentUserPersonalDetails={LHNTestUtils.fakePersonalDetails[currentUserAccountID]} | ||
/> | ||
</ActionListContext.Provider> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.