Skip to content

Commit

Permalink
fix missing render in test
Browse files Browse the repository at this point in the history
  • Loading branch information
wildan-m committed Feb 6, 2025
1 parent 2b4de45 commit 1597c1c
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions tests/unit/ReportActionItemSingleTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,30 +55,33 @@ describe('ReportActionItemSingle', () => {

function setup() {
const policyCollectionDataSet = toCollectionDataSet(ONYXKEYS.COLLECTION.POLICY, [fakePolicy], (item) => item.id);

return waitForBatchedUpdates().then(() =>
Onyx.multiSet({
[ONYXKEYS.PERSONAL_DETAILS_LIST]: fakePersonalDetails,
[ONYXKEYS.IS_LOADING_REPORT_DATA]: false,
...policyCollectionDataSet,
}),
);
return waitForBatchedUpdates()
.then(() =>
Onyx.multiSet({
[ONYXKEYS.PERSONAL_DETAILS_LIST]: fakePersonalDetails,
[ONYXKEYS.IS_LOADING_REPORT_DATA]: false,
...policyCollectionDataSet,
}),
)
.then(() => {
LHNTestUtils.getDefaultRenderedReportActionItemSingle(shouldShowSubscriptAvatar, fakeReport, fakeReportAction);
});
}

it('renders secondary Avatar properly', async () => {
const expectedSecondaryIconTestId = 'SvgDefaultAvatar_w Icon';

await setup();
LHNTestUtils.getDefaultRenderedReportActionItemSingle(shouldShowSubscriptAvatar, fakeReport, fakeReportAction);
await waitFor(() => {
expect(screen.getByTestId(expectedSecondaryIconTestId)).toBeOnTheScreen();
});
});

it('renders Person information', () => {
it('renders Person information', async () => {
const [expectedPerson] = fakeReportAction.person ?? [];

return setup().then(() => {
await setup();
await waitFor(() => {
expect(screen.getByText(expectedPerson.text ?? '')).toBeOnTheScreen();
});
});
Expand Down

0 comments on commit 1597c1c

Please sign in to comment.