diff --git a/tests/unit/SidebarUtilsTest.ts b/tests/unit/SidebarUtilsTest.ts index 83ce24da8efb..44f9c575e342 100644 --- a/tests/unit/SidebarUtilsTest.ts +++ b/tests/unit/SidebarUtilsTest.ts @@ -907,29 +907,11 @@ describe('SidebarUtils', () => { expect(result?.alternateText).toBe(`You invited 1 member`); }); it('returns the last action message as an alternate text if the action is MOVED type', async () => { - // When a report has last action of MOVED type - const policy: Policy = { - ...createRandomPolicy(1), - pendingAction: null, - }; - const session = { - authToken: 'sensitive-auth-token', - encryptedAuthToken: 'sensitive-encrypted-token', - email: 'user@example.com', - accountID: 12345, - }; const report: Report = { ...createRandomReport(4), - chatType: 'policyRoom', - lastMessageHtml: '', - lastMessageText: '', - lastVisibleActionCreated: '2025-04-27 12:30:03.784', - participants: { - '12345': { - notificationPreference: 'daily', - }, - }, - policyID: '1', + chatType: 'policyExpenseChat', + pendingAction: null, + isOwnPolicyExpenseChat: true, }; const lastAction: ReportAction = { ...createRandomReportAction(2), @@ -938,31 +920,20 @@ describe('SidebarUtils', () => { type: 'COMMENT', html: "moved this report to the Three's Workspace workspace", text: "moved this report to the Three's Workspace workspace", - isEdited: false, - whisperedTo: [], - isDeletedParentAction: false, - deleted: '', }, ], originalMessage: { - lastModified: '2025-04-27 12:32:10.416', - targetAccountIDs: [19268914], + whisperedTo: [], }, - actorAccountID: 12345, actionName: CONST.REPORT.ACTIONS.TYPE.MOVED, - person: [ - { - type: 'TEXT', - style: 'strong', - text: 'f50', - }, - ], + created: DateUtils.getDBTime(), + lastModified: DateUtils.getDBTime(), + shouldShow: true, + pendingAction: null, }; const reportActions: ReportActions = {[lastAction.reportActionID]: lastAction}; await Onyx.set(`${ONYXKEYS.COLLECTION.REPORT}${report.reportID}`, report); await Onyx.set(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report.reportID}`, reportActions); - await Onyx.set(ONYXKEYS.SESSION, session); - await Onyx.set(`${ONYXKEYS.COLLECTION.POLICY}1`, policy); const result = SidebarUtils.getOptionData({ report, reportAttributes: {}, @@ -976,8 +947,7 @@ describe('SidebarUtils', () => { oneTransactionThreadReport: undefined, }); - // Then the alternate text should be equal to the message of the last action prepended with the last actor display name. - expect(result?.alternateText).toBe(`${lastAction.person?.[0].text}: ${getReportActionMessageText(lastAction)}`); + expect(result?.alternateText).toBe(`You: ${getReportActionMessageText(lastAction)}`); }); }); });