Skip to content

Commit 6bb2423

Browse files
fix test in ReportUtilsTest
1 parent 516ea5f commit 6bb2423

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

tests/unit/ReportUtilsTest.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3141,14 +3141,24 @@ describe('ReportUtils', () => {
31413141
});
31423142

31433143
describe('getMoneyReportPreviewName', () => {
3144-
it('should return the report name if present', () => {
3144+
it('should return the report name if present', async () => {
31453145
const action: ReportAction = {
31463146
...createRandomReportAction(1),
31473147
actionName: CONST.REPORT.ACTIONS.TYPE.REPORT_PREVIEW,
31483148
};
31493149
const report: Report = {
31503150
...createRandomReport(1),
3151+
type: CONST.REPORT.TYPE.CHAT,
3152+
chatType: CONST.REPORT.CHAT_TYPE.GROUP,
3153+
participants: buildParticipantsFromAccountIDs([1, 2, 3, 4, 5, 6]),
3154+
reportName: '', // Clear the random report name so it uses participant names
31513155
};
3156+
3157+
// Set up the fake personal details and the report in Onyx so derived values work
3158+
await Onyx.merge(ONYXKEYS.PERSONAL_DETAILS_LIST, fakePersonalDetails);
3159+
await Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${report.reportID}`, report);
3160+
await waitForBatchedUpdates();
3161+
31523162
const result = getMoneyReportPreviewName(action, report);
31533163
expect(result).toBe('Five, Four, One, Three, Two...');
31543164
});

0 commit comments

Comments
 (0)