diff --git a/tests/ui/LHNItemsPresence.tsx b/tests/ui/LHNItemsPresence.tsx index 266b8292c27f..7630b186c69b 100644 --- a/tests/ui/LHNItemsPresence.tsx +++ b/tests/ui/LHNItemsPresence.tsx @@ -196,33 +196,31 @@ describe('SidebarLinksData', () => { LHNTestUtils.getDefaultRenderedSidebarLinks(); // And the report is initialized in Onyx. - const report: Report = { - ...createReport(true, undefined, undefined, CONST.REPORT.CHAT_TYPE.POLICY_EXPENSE_CHAT, TEST_POLICY_ID), + const expenseReport: Report = { + ...createReport(false, undefined, undefined, undefined, TEST_POLICY_ID), ownerAccountID: TEST_USER_ACCOUNT_ID, + type: CONST.REPORT.TYPE.EXPENSE, }; await initializeState({ - [`${ONYXKEYS.COLLECTION.REPORT}${report.reportID}`]: report, + [`${ONYXKEYS.COLLECTION.REPORT}${expenseReport.reportID}`]: expenseReport, }); - // The report should appear in the sidebar because it’s pinned. - expect(getOptionRows()).toHaveLength(1); + // The report should not appear in the sidebar because it's hidden + expect(getOptionRows()).toHaveLength(0); await waitForBatchedUpdatesWithAct(); - const expenseReport: Report = { - ...createReport(true, undefined, undefined, undefined, TEST_POLICY_ID), - ownerAccountID: TEST_USER_ACCOUNT_ID, - type: CONST.REPORT.TYPE.EXPENSE, - }; - const transaction = LHNTestUtils.getFakeTransaction(expenseReport.reportID); const transactionViolation = createFakeTransactionViolation(); - await Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${expenseReport.reportID}`, expenseReport); + // When the report has outstanding violations await Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION}${transaction.transactionID}`, transaction); await Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transaction.transactionID}`, [transactionViolation]); - // And the draft icon should be shown, indicating there is unsent content. + // The report should appear in the sidebar because it has violations + expect(getOptionRows()).toHaveLength(0); + + // And the RBR icon should be shown expect(screen.getByTestId('RBR Icon')).toBeOnTheScreen(); }); });