Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 22 additions & 38 deletions src/libs/OptionsListUtils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,13 @@
*/

let allPersonalDetails: OnyxEntry<PersonalDetailsList>;
Onyx.connect({

Check warning on line 201 in src/libs/OptionsListUtils/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function

Check warning on line 201 in src/libs/OptionsListUtils/index.ts

View workflow job for this annotation

GitHub Actions / ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
callback: (value) => (allPersonalDetails = isEmptyObject(value) ? {} : value),
});

const policies: OnyxCollection<Policy> = {};
Onyx.connect({

Check warning on line 207 in src/libs/OptionsListUtils/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function

Check warning on line 207 in src/libs/OptionsListUtils/index.ts

View workflow job for this annotation

GitHub Actions / ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.POLICY,
callback: (policy, key) => {
if (!policy || !key || !policy.name) {
Expand All @@ -216,7 +216,7 @@
});

let allReports: OnyxCollection<Report>;
Onyx.connect({

Check warning on line 219 in src/libs/OptionsListUtils/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function

Check warning on line 219 in src/libs/OptionsListUtils/index.ts

View workflow job for this annotation

GitHub Actions / ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -225,7 +225,7 @@
});

let allReportNameValuePairsOnyxConnect: OnyxCollection<ReportNameValuePairs>;
Onyx.connect({

Check warning on line 228 in src/libs/OptionsListUtils/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -237,7 +237,7 @@
const allSortedReportActions: Record<string, ReportAction[]> = {};
let allReportActions: OnyxCollection<ReportActions>;
const lastVisibleReportActions: ReportActions = {};
Onyx.connect({

Check warning on line 240 in src/libs/OptionsListUtils/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT_ACTIONS,
waitForCollectionCallback: true,
callback: (actions) => {
Expand Down Expand Up @@ -299,7 +299,7 @@
});

let activePolicyID: OnyxEntry<string>;
Onyx.connect({

Check warning on line 302 in src/libs/OptionsListUtils/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.NVP_ACTIVE_POLICY_ID,
callback: (value) => (activePolicyID = value),
});
Expand Down Expand Up @@ -2264,17 +2264,12 @@
// This prevents the issue of seeing the selected option twice if you have them as a recent chat and select them
if (!includeSelectedOptions) {
for (const option of selectedOptions) {
if (option.login) {
// Prevent re-inviting already selected users
loginsToExclude[option.login] = true;
loginsToExcludeFromSuggestions[option.login] = true;
if (!option.login) {
continue;
}

if (option.reportID) {
loginsToExclude[option.reportID] = true;
loginsToExcludeFromSuggestions[option.reportID] = true;
}
// Prevent re-inviting already selected users
loginsToExclude[option.login] = true;
loginsToExcludeFromSuggestions[option.login] = true;
}
}
const {includeP2P = true, shouldBoldTitleByDefault = true, includeDomainEmail = false, shouldShowGBR = false, ...getValidReportsConfig} = config;
Expand Down Expand Up @@ -2780,24 +2775,19 @@
// We show the selected participants at the top of the list when there is no search term or maximum number of participants has already been selected
// However, if there is a search term we remove the selected participants from the top of the list unless they are part of the search results
// This clears up space on mobile views, where if you create a group with 4+ people you can't see the selected participants and the search results at the same time
const selectedOptionsMapper = (participant: Participant) => {
const isReportPolicyExpenseChat = participant.isPolicyExpenseChat ?? false;
const isIOUInvoiceRoom = participant.accountID === CONST.DEFAULT_NUMBER_ID && !!participant.reportID && 'iouType' in participant && participant.iouType === 'invoice';
if (participant.isSelfDM || isIOUInvoiceRoom) {
const privateIsArchived = allReportNameValuePairsOnyxConnect?.[`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${participant.reportID}`]?.private_isArchived;
return getReportOption(participant, privateIsArchived, undefined, currentUserAccountID, personalDetails, reportAttributesDerived);
}
return isReportPolicyExpenseChat
? getPolicyExpenseReportOption(participant, currentUserAccountID, personalDetails, reportAttributesDerived)
: getParticipantsOption(participant, personalDetails);
};

if (searchTerm === '') {
return {
section: {
title: undefined,
sectionIndex: 0,
data: shouldGetOptionDetails ? selectedOptions.map(selectedOptionsMapper) : selectedOptions,
data: shouldGetOptionDetails
? selectedOptions.map((participant) => {
const isReportPolicyExpenseChat = participant.isPolicyExpenseChat ?? false;
return isReportPolicyExpenseChat
? getPolicyExpenseReportOption(participant, currentUserAccountID, personalDetails, reportAttributesDerived)
: getParticipantsOption(participant, personalDetails);
})
: selectedOptions,
},
};
}
Expand All @@ -2807,20 +2797,7 @@
// This will add them to the list of options, deduping them if they already exist in the other lists
const selectedParticipantsWithoutDetails = selectedOptions.filter((participant) => {
const accountID = participant.accountID ?? null;
let currentParticipant = participant;
if (currentParticipant.isSelfDM) {
currentParticipant = {...currentParticipant, accountID: currentUserAccountID};
}
const isPartOfSearchTerm = getPersonalDetailSearchTerms(
{
...currentParticipant,
login: currentParticipant.login ?? personalDetails[currentParticipant.accountID ?? CONST.DEFAULT_NUMBER_ID]?.login,
},
currentUserAccountID,
)
.join(' ')
.toLowerCase()
.includes(cleanSearchTerm);
const isPartOfSearchTerm = getPersonalDetailSearchTerms(participant, currentUserAccountID).join(' ').toLowerCase().includes(cleanSearchTerm);
const isReportInRecentReports = filteredRecentReports.some((report) => report.accountID === accountID) || filteredWorkspaceChats.some((report) => report.accountID === accountID);
const isReportInPersonalDetails = filteredPersonalDetails.some((personalDetail) => personalDetail.accountID === accountID);

Expand All @@ -2831,7 +2808,14 @@
section: {
title: undefined,
sectionIndex: 0,
data: shouldGetOptionDetails ? selectedParticipantsWithoutDetails.map(selectedOptionsMapper) : selectedParticipantsWithoutDetails,
data: shouldGetOptionDetails
? selectedParticipantsWithoutDetails.map((participant) => {
const isReportPolicyExpenseChat = participant.isPolicyExpenseChat ?? false;
return isReportPolicyExpenseChat
? getPolicyExpenseReportOption(participant, currentUserAccountID, personalDetails, reportAttributesDerived)
: getParticipantsOption(participant, personalDetails);
})
: selectedParticipantsWithoutDetails,
},
};
}
Expand All @@ -2853,7 +2837,7 @@
if (item.accountID === currentUserAccountID) {
return getCurrentUserSearchTerms(item);
}
return [item.participantsList?.[0]?.displayName ?? item.displayName ?? '', item.login ?? '', item.login?.replace(CONST.EMAIL_SEARCH_REGEX, '') ?? '', item.text ?? ''];
return [item.participantsList?.[0]?.displayName ?? item.displayName ?? '', item.login ?? '', item.login?.replace(CONST.EMAIL_SEARCH_REGEX, '') ?? ''];
}

function getCurrentUserSearchTerms(item: Partial<SearchOptionData>) {
Expand Down
11 changes: 1 addition & 10 deletions src/libs/actions/IOU/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@
};

let allPersonalDetails: OnyxTypes.PersonalDetailsList = {};
Onyx.connect({

Check warning on line 804 in src/libs/actions/IOU/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
callback: (value) => {
allPersonalDetails = value ?? {};
Expand Down Expand Up @@ -894,7 +894,7 @@
};

let allTransactions: NonNullable<OnyxCollection<OnyxTypes.Transaction>> = {};
Onyx.connect({

Check warning on line 897 in src/libs/actions/IOU/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.TRANSACTION,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -908,7 +908,7 @@
});

let allTransactionDrafts: NonNullable<OnyxCollection<OnyxTypes.Transaction>> = {};
Onyx.connect({

Check warning on line 911 in src/libs/actions/IOU/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.TRANSACTION_DRAFT,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -917,7 +917,7 @@
});

let allTransactionViolations: NonNullable<OnyxCollection<OnyxTypes.TransactionViolations>> = {};
Onyx.connect({

Check warning on line 920 in src/libs/actions/IOU/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS,
waitForCollectionCallback: true,
callback: (value) => {
Expand Down Expand Up @@ -12289,16 +12289,7 @@
let participants: Participant[] = [];

if (isPolicyExpenseChat || shouldAddAsReport) {
participants = [
{
accountID: 0,
reportID: chatReport?.reportID,
isPolicyExpenseChat,
selected: true,
policyID: isPolicyExpenseChat ? chatReport?.policyID : undefined,
isSelfDM: shouldAddAsReport,
},
];
participants = [{accountID: 0, reportID: chatReport?.reportID, isPolicyExpenseChat, selected: true, policyID: isPolicyExpenseChat ? chatReport?.policyID : undefined}];
} else if (isInvoiceRoom(chatReport)) {
participants = [
{reportID: chatReport?.reportID, selected: true},
Expand Down
53 changes: 22 additions & 31 deletions src/pages/iou/request/MoneyRequestParticipantsSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -218,27 +218,26 @@ function MoneyRequestParticipantsSelector({
[isIOUSplit, iouType, onParticipantsAdded],
);

const {searchTerm, debouncedSearchTerm, setSearchTerm, availableOptions, selectedOptions, setSelectedOptions, toggleSelection, areOptionsInitialized, onListEndReached, contactState} =
useSearchSelector({
selectionMode: isIOUSplit ? CONST.SEARCH_SELECTOR.SELECTION_MODE_MULTI : CONST.SEARCH_SELECTOR.SELECTION_MODE_SINGLE,
searchContext: CONST.SEARCH_SELECTOR.SEARCH_CONTEXT_GENERAL,
includeUserToInvite: !isCategorizeOrShareAction && !isPerDiemRequest,
excludeLogins: CONST.EXPENSIFY_EMAILS_OBJECT,
includeRecentReports: true,
maxRecentReportsToShow: CONST.IOU.MAX_RECENT_REPORTS_TO_SHOW,
getValidOptionsConfig,
shouldInitialize: didScreenTransitionEnd,
enablePhoneContacts: isNative,
contactOptions: contacts,
initialSelected: participants as OptionData[],
onSelectionChange: handleSelectionChange,
onSingleSelect: (option: OptionData) => {
if (isIOUSplit) {
return;
}
addSingleParticipant(option);
},
});
const {searchTerm, debouncedSearchTerm, setSearchTerm, availableOptions, selectedOptions, toggleSelection, areOptionsInitialized, onListEndReached, contactState} = useSearchSelector({
selectionMode: isIOUSplit ? CONST.SEARCH_SELECTOR.SELECTION_MODE_MULTI : CONST.SEARCH_SELECTOR.SELECTION_MODE_SINGLE,
searchContext: CONST.SEARCH_SELECTOR.SEARCH_CONTEXT_GENERAL,
includeUserToInvite: !isCategorizeOrShareAction && !isPerDiemRequest,
excludeLogins: CONST.EXPENSIFY_EMAILS_OBJECT,
includeRecentReports: true,
maxRecentReportsToShow: CONST.IOU.MAX_RECENT_REPORTS_TO_SHOW,
getValidOptionsConfig,
shouldInitialize: didScreenTransitionEnd,
enablePhoneContacts: isNative,
contactOptions: contacts,
initialSelected: participants as OptionData[],
onSelectionChange: handleSelectionChange,
onSingleSelect: (option: OptionData) => {
if (isIOUSplit) {
return;
}
addSingleParticipant(option);
},
});

const cleanSearchTerm = useMemo(() => debouncedSearchTerm.trim().toLowerCase(), [debouncedSearchTerm]);

Expand Down Expand Up @@ -415,15 +414,9 @@ function MoneyRequestParticipantsSelector({
return;
}

// If the selected option is self DM, we need to recall onParticipantsAdded to handle navigation correctly
if (!option && selectedOptions.length === 1 && selectedOptions.at(0)?.isSelfDM) {
onParticipantsAdded(selectedOptions.map((selectedOption) => sanitizedSelectedParticipant(selectedOption, iouType)));
return;
}

onFinish(CONST.IOU.TYPE.SPLIT);
},
[shouldShowSplitBillErrorMessage, onFinish, addSingleParticipant, onParticipantsAdded, selectedOptions, iouType],
[shouldShowSplitBillErrorMessage, onFinish, addSingleParticipant, selectedOptions.length],
);

const showLoadingPlaceholder = useMemo(() => !areOptionsInitialized || !didScreenTransitionEnd, [areOptionsInitialized, didScreenTransitionEnd]);
Expand Down Expand Up @@ -519,11 +512,9 @@ function MoneyRequestParticipantsSelector({
return;
}

const reportID = option.reportID ?? CONST.REPORT.UNREPORTED_REPORT_ID;
setSelectedOptions([{...option, isSelected: true, reportID, keyForList: reportID}]);
addSingleParticipant(option);
},
[isIOUSplit, addParticipantToSelection, addSingleParticipant, setSelectedOptions],
[isIOUSplit, addParticipantToSelection, addSingleParticipant],
);

const importContactsButtonComponent = useMemo(() => {
Expand Down
21 changes: 7 additions & 14 deletions src/pages/iou/request/step/IOURequestStepAmount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import {
getMoneyRequestParticipantsFromReport,
requestMoney,
setMoneyRequestAmount,
setMoneyRequestParticipants,
setMoneyRequestParticipantsFromReport,
setMoneyRequestTaxAmount,
setMoneyRequestTaxRate,
Expand Down Expand Up @@ -315,15 +314,12 @@ function IOURequestStepAmount({

// Starting from global + menu means no participant context exists yet,
// so we need to handle participant selection based on available workspace settings
const isReturningFromConfirmationPage = !!transaction?.participants?.length;
const firstParticipant = transaction?.participants?.at(0);
const isP2PChat = isParticipantP2P(firstParticipant, currentUserPersonalDetails.accountID);
const isNegativeAmount = convertToBackendAmount(Number.parseFloat(amount)) < 0;
if (shouldUseDefaultExpensePolicy(iouType, defaultExpensePolicy)) {
const shouldAutoReport = !!defaultExpensePolicy?.autoReporting || !!personalPolicy?.autoReporting;
const targetReport = shouldAutoReport ? getPolicyExpenseChat(currentUserAccountIDParam, defaultExpensePolicy?.id) : selfDMReport;
const transactionReportID = isSelfDM(targetReport) ? CONST.REPORT.UNREPORTED_REPORT_ID : targetReport?.reportID;
const iouTypeTrackOrSubmit = transactionReportID === CONST.REPORT.UNREPORTED_REPORT_ID ? CONST.IOU.TYPE.TRACK : CONST.IOU.TYPE.SUBMIT;
const isReturningFromConfirmationPage = !!transaction?.participants?.length;

const resetToDefaultWorkspace = () => {
setTransactionReport(transactionID, {reportID: transactionReportID}, true);
Expand All @@ -333,6 +329,10 @@ function IOURequestStepAmount({
};

if (isReturningFromConfirmationPage) {
const firstParticipant = transaction?.participants?.at(0);
const isP2PChat = isParticipantP2P(firstParticipant);
const isNegativeAmount = convertToBackendAmount(Number.parseFloat(amount)) < 0;

// P2P chats don't support negative amounts, so reset to default workspace when amount is negative.
if (isP2PChat && isNegativeAmount) {
resetToDefaultWorkspace();
Expand All @@ -351,13 +351,6 @@ function IOURequestStepAmount({
} else {
resetToDefaultWorkspace();
}
}
// P2P chats don't support negative amounts, so in cases where there is no default workspace when the amount is negative, we will remove the selected transaction participants.
else if (iouType === CONST.IOU.TYPE.CREATE && isP2PChat && isNegativeAmount && isReturningFromConfirmationPage) {
setTransactionReport(transactionID, {reportID: undefined}, true);
setMoneyRequestParticipants(transactionID, [], true).then(() => {
navigateToParticipantPage(iouType, transactionID, reportID);
});
} else {
Navigation.setNavigationActionToMicrotaskQueue(() => {
navigateToParticipantPage(iouType, transactionID, reportID);
Expand Down Expand Up @@ -477,8 +470,8 @@ function IOURequestStepAmount({
/**
* Check if the participant is a P2P chat
*/
function isParticipantP2P(participant: {accountID?: number; isPolicyExpenseChat?: boolean} | undefined, currentUserAccountID?: number): boolean {
return !!(participant?.accountID && !participant.isPolicyExpenseChat && (!currentUserAccountID || participant?.accountID !== currentUserAccountID));
function isParticipantP2P(participant: {accountID?: number; isPolicyExpenseChat?: boolean} | undefined): boolean {
return !!(participant?.accountID && !participant.isPolicyExpenseChat);
}

// eslint-disable-next-line rulesdir/no-negated-variables
Expand Down
14 changes: 5 additions & 9 deletions src/pages/iou/request/step/IOURequestStepParticipants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import ROUTES from '@src/ROUTES';
import type SCREENS from '@src/SCREENS';
import type {Policy} from '@src/types/onyx';
import type {Participant} from '@src/types/onyx/IOU';
import getEmptyArray from '@src/types/utils/getEmptyArray';
import KeyboardUtils from '@src/utils/keyboard';
import StepScreenWrapper from './StepScreenWrapper';
import type {WithFullTransactionOrNotFoundProps} from './withFullTransactionOrNotFound';
Expand Down Expand Up @@ -71,11 +72,7 @@ function IOURequestStepParticipants({
},
transaction: initialTransaction,
}: IOURequestStepParticipantsProps) {
const isSplitRequest = iouType === CONST.IOU.TYPE.SPLIT;
const participants = useMemo(() => {
const allParticipants = initialTransaction?.participants;
return isSplitRequest ? allParticipants : allParticipants?.filter((participant) => !participant.isSender && participant.selected);
}, [initialTransaction?.participants, isSplitRequest]);
const participants = initialTransaction?.participants;
const {translate} = useLocalize();
const styles = useThemeStyles();
const isFocused = useIsFocused();
Expand All @@ -90,11 +87,10 @@ function IOURequestStepParticipants({
const transactionIDs = useMemo(() => transactions?.map((transaction) => transaction.transactionID), [transactions.length]);

// We need to set selectedReportID if user has navigated back from confirmation page and navigates to confirmation page with already selected participant
// We need to disable the eslint rule here because the reportID from the first participant can be an empty string
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
const selectedReportID = useRef<string>(participants?.length === 1 ? participants.at(0)?.reportID || reportID : reportID);
const selectedReportID = useRef<string>(participants?.length === 1 ? (participants.at(0)?.reportID ?? reportID) : reportID);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Fall back when selected participant reportID is empty

selectedReportID now uses nullish coalescing, which treats '' as a valid value; in this flow participants.at(0)?.reportID can be an empty string (e.g., when returning to participants after selecting a recipient without an existing chat), so the ref is initialized to '' instead of the route reportID. That empty ID is then used to build the confirmation route, producing an invalid/empty :reportID segment and breaking navigation back to confirmation for those recipients.

Useful? React with 👍 / 👎.

const numberOfParticipants = useRef(participants?.length ?? 0);
const iouRequestType = getRequestType(initialTransaction);
const isSplitRequest = iouType === CONST.IOU.TYPE.SPLIT;
const isMovingTransactionFromTrackExpense = isMovingTransactionFromTrackExpenseIOUUtils(action);
const headerTitle = useMemo(() => {
if (action === CONST.IOU.ACTION.CATEGORIZE) {
Expand Down Expand Up @@ -458,7 +454,7 @@ function IOURequestStepParticipants({
/>
)}
<MoneyRequestParticipantsSelector
participants={participants}
participants={isSplitRequest ? participants : getEmptyArray()}
onParticipantsAdded={addParticipant}
onFinish={goToNextStep}
iouType={iouType}
Expand Down
27 changes: 0 additions & 27 deletions tests/unit/OptionsListUtilsTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1725,33 +1725,6 @@ describe('OptionsListUtils', () => {
expect(results.recentReports).not.toEqual(expect.arrayContaining([expect.objectContaining({login: 'receipts@expensify.com'})]));
});

it('should exclude the person and the report from selected options', () => {
const selectedPerson = PERSONAL_DETAILS['3'];
const selectedReport = REPORTS['3'] as unknown as OptionData;

const results = getValidOptions(
{reports: OPTIONS.reports, personalDetails: OPTIONS.personalDetails},
allPolicies,
{},
nvpDismissedProductTraining,
loginList,
CURRENT_USER_ACCOUNT_ID,
CURRENT_USER_EMAIL,
{
excludeLogins: CONST.EXPENSIFY_EMAILS_OBJECT,
selectedOptions: [selectedPerson, selectedReport],
},
);

// The person must be excluded
expect(results.recentReports.every((option) => option.login !== selectedPerson.login)).toBe(true);
expect(results.personalDetails.every((option) => option.login !== selectedPerson.login)).toBe(true);

// The report must be excluded
expect(results.recentReports.every((option) => option.reportID !== selectedReport.reportID)).toBe(true);
expect(results.personalDetails.every((option) => option.reportID !== selectedPerson.reportID)).toBe(true);
});

it('should limit recent reports when maxRecentReportElements is specified', () => {
// Given a set of reports and personalDetails with multiple reports
// When we call getValidOptions with maxRecentReportElements set to 2
Expand Down
Loading