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
5 changes: 2 additions & 3 deletions __mocks__/react-native-permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ const request = jest.fn(() => RESULTS.GRANTED as string);
const checkLocationAccuracy: jest.Mock<string> = jest.fn(() => 'full');
const requestLocationAccuracy: jest.Mock<string> = jest.fn(() => 'full');

// eslint-disable-next-line unicorn/prefer-set-has
const notificationOptions: string[] = ['alert', 'badge', 'sound', 'carPlay', 'criticalAlert', 'provisional'];
const notificationOptions = new Set<string>(['alert', 'badge', 'sound', 'carPlay', 'criticalAlert', 'provisional']);

const notificationSettings: NotificationSettings = {
alert: true,
Expand All @@ -35,7 +34,7 @@ const checkNotifications: jest.Mock<Notification> = jest.fn(() => ({
const requestNotifications: jest.Mock<Notification> = jest.fn((options: Record<string, string>) => ({
status: RESULTS.GRANTED,
settings: Object.keys(options)
.filter((option: string) => notificationOptions.includes(option))
.filter((option: string) => notificationOptions.has(option))
.reduce(
(acc: NotificationSettings, option: string) => {
acc[option] = true;
Expand Down
7 changes: 3 additions & 4 deletions src/components/Form/InputWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ import type {ForwardedFSClassProps} from '@libs/Fullstory/types';
import FormContext from './FormContext';
import type {InputComponentBaseProps, InputComponentValueProps, ValidInputs, ValueTypeKey} from './types';

type TextInputBasedComponents = [ComponentType<BaseTextInputProps>, ComponentType<RoomNameInputProps>];
type TextInputBasedComponents = Set<ComponentType<BaseTextInputProps> | ComponentType<RoomNameInputProps>>;

// eslint-disable-next-line unicorn/prefer-set-has
const textInputBasedComponents: TextInputBasedComponents = [TextInput, RoomNameInput];
const textInputBasedComponents: TextInputBasedComponents = new Set([TextInput, RoomNameInput]);

type ComputedComponentSpecificRegistrationParams = {
shouldSubmitForm: boolean;
Expand All @@ -28,7 +27,7 @@ function computeComponentSpecificRegistrationParams({
autoGrowHeight,
blurOnSubmit,
}: InputComponentBaseProps): ComputedComponentSpecificRegistrationParams {
if (textInputBasedComponents.includes(InputComponent)) {
if (textInputBasedComponents.has(InputComponent)) {
const isEffectivelyMultiline = !!multiline || !!autoGrowHeight;

// If the user can use the hardware keyboard, they have access to an alternative way of inserting a new line
Expand Down
12 changes: 5 additions & 7 deletions src/components/ReportActionItem/MoneyRequestReceiptView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,16 @@ type MoneyRequestReceiptViewProps = {
isDisplayedInWideRHP?: boolean;
};

// eslint-disable-next-line unicorn/prefer-set-has
const receiptImageViolationNames: OnyxTypes.ViolationName[] = [
const receiptImageViolationNames = new Set<OnyxTypes.ViolationName>([
CONST.VIOLATIONS.RECEIPT_REQUIRED,
CONST.VIOLATIONS.RECEIPT_NOT_SMART_SCANNED,
CONST.VIOLATIONS.CASH_EXPENSE_WITH_NO_RECEIPT,
CONST.VIOLATIONS.SMARTSCAN_FAILED,
CONST.VIOLATIONS.PROHIBITED_EXPENSE,
CONST.VIOLATIONS.RECEIPT_GENERATED_WITH_AI,
];
]);

// eslint-disable-next-line unicorn/prefer-set-has
const receiptFieldViolationNames: OnyxTypes.ViolationName[] = [CONST.VIOLATIONS.MODIFIED_AMOUNT, CONST.VIOLATIONS.MODIFIED_DATE];
const receiptFieldViolationNames = new Set<OnyxTypes.ViolationName>([CONST.VIOLATIONS.MODIFIED_AMOUNT, CONST.VIOLATIONS.MODIFIED_DATE]);

function MoneyRequestReceiptView({
allReports,
Expand Down Expand Up @@ -169,8 +167,8 @@ function MoneyRequestReceiptView({
const allViolations = [];

for (const violation of transactionViolations ?? []) {
const isReceiptFieldViolation = receiptFieldViolationNames.includes(violation.name);
const isReceiptImageViolation = receiptImageViolationNames.includes(violation.name);
const isReceiptFieldViolation = receiptFieldViolationNames.has(violation.name);
const isReceiptImageViolation = receiptImageViolationNames.has(violation.name);
if (isReceiptFieldViolation || isReceiptImageViolation) {
const violationMessage = ViolationsUtils.getViolationTranslation(violation, translate, canEdit);
allViolations.push(violationMessage);
Expand Down
5 changes: 2 additions & 3 deletions src/libs/HttpUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ abortControllerMap.set(ABORT_COMMANDS.SearchForReports, new AbortController());
/**
* The API commands that require the skew calculation
*/
// eslint-disable-next-line unicorn/prefer-set-has
const addSkewList: string[] = [WRITE_COMMANDS.OPEN_REPORT, SIDE_EFFECT_REQUEST_COMMANDS.RECONNECT_APP, WRITE_COMMANDS.OPEN_APP];
const addSkewList = new Set<string>([WRITE_COMMANDS.OPEN_REPORT, SIDE_EFFECT_REQUEST_COMMANDS.RECONNECT_APP, WRITE_COMMANDS.OPEN_APP]);

/**
* Regex to get API command from the command
Expand All @@ -70,7 +69,7 @@ function processHTTPRequest(url: string, method: RequestType = 'get', body: Form
.then((response) => {
// We are calculating the skew to minimize the delay when posting the messages
const match = url.match(APICommandRegex)?.[1];
if (match && addSkewList.includes(match) && response.headers) {
if (match && addSkewList.has(match) && response.headers) {
const dateHeaderValue = response.headers.get('Date');
const serverTime = dateHeaderValue ? new Date(dateHeaderValue).valueOf() : new Date().valueOf();
const endTime = new Date().valueOf();
Expand Down
10 changes: 3 additions & 7 deletions src/libs/Middleware/SaveResponseInOnyx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@ import type Middleware from './types';

// If we're executing any of these requests, we don't need to trigger our OnyxUpdates flow to update the current data even if our current value is out of
// date because all these requests are updating the app to the most current state.
// eslint-disable-next-line unicorn/prefer-set-has
const requestsToIgnoreLastUpdateID: string[] = [
const requestsToIgnoreLastUpdateID = new Set<string>([
WRITE_COMMANDS.OPEN_APP,
SIDE_EFFECT_REQUEST_COMMANDS.RECONNECT_APP,
WRITE_COMMANDS.CLOSE_ACCOUNT,
WRITE_COMMANDS.DELETE_MONEY_REQUEST,
SIDE_EFFECT_REQUEST_COMMANDS.GET_MISSING_ONYX_MESSAGES,
];
]);

const SaveResponseInOnyx: Middleware = (requestResponse, request) =>
requestResponse.then((response = {}) => {
Expand All @@ -32,10 +31,7 @@ const SaveResponseInOnyx: Middleware = (requestResponse, request) =>
response: response ?? {},
};

if (
requestsToIgnoreLastUpdateID.includes(request.command) ||
!OnyxUpdates.doesClientNeedToBeUpdated({previousUpdateID: Number(response?.previousUpdateID ?? CONST.DEFAULT_NUMBER_ID)})
) {
if (requestsToIgnoreLastUpdateID.has(request.command) || !OnyxUpdates.doesClientNeedToBeUpdated({previousUpdateID: Number(response?.previousUpdateID ?? CONST.DEFAULT_NUMBER_ID)})) {
return OnyxUpdates.apply(responseToApply);
}

Expand Down
5 changes: 2 additions & 3 deletions src/libs/MoneyRequestReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ import {isTransactionPendingDelete} from './TransactionUtils';
* In MoneyRequestReport we filter out some IOU action types, because expense/transaction data is displayed in a separate list
* at the top
*/
// eslint-disable-next-line unicorn/prefer-set-has
const IOU_ACTIONS_TO_FILTER_OUT: Array<OriginalMessageIOU['type']> = [CONST.IOU.REPORT_ACTION_TYPE.CREATE, CONST.IOU.REPORT_ACTION_TYPE.TRACK];
const IOU_ACTIONS_TO_FILTER_OUT = new Set<OriginalMessageIOU['type']>([CONST.IOU.REPORT_ACTION_TYPE.CREATE, CONST.IOU.REPORT_ACTION_TYPE.TRACK]);

/**
* Returns whether a specific action should be displayed in the feed/message list on MoneyRequestReportView.
Expand All @@ -34,7 +33,7 @@ const IOU_ACTIONS_TO_FILTER_OUT: Array<OriginalMessageIOU['type']> = [CONST.IOU.
function isActionVisibleOnMoneyRequestReport(action: ReportAction) {
if (isMoneyRequestAction(action)) {
const originalMessage = getOriginalMessage(action);
return originalMessage ? !IOU_ACTIONS_TO_FILTER_OUT.includes(originalMessage.type) : false;
return originalMessage ? !IOU_ACTIONS_TO_FILTER_OUT.has(originalMessage.type) : false;
}

return action.actionName !== CONST.REPORT.ACTIONS.TYPE.CREATED;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ import NAVIGATORS from '@src/NAVIGATORS';
import SCREENS from '@src/SCREENS';
import type {OpenWorkspaceSplitActionType, PushActionType, ReplaceActionType, ToggleSidePanelWithHistoryActionType} from './types';

// eslint-disable-next-line unicorn/prefer-set-has
const MODAL_ROUTES_TO_DISMISS: string[] = [
const MODAL_ROUTES_TO_DISMISS = new Set<string>([
NAVIGATORS.WORKSPACE_SPLIT_NAVIGATOR,
NAVIGATORS.RIGHT_MODAL_NAVIGATOR,
NAVIGATORS.ONBOARDING_MODAL_NAVIGATOR,
Expand All @@ -28,7 +27,7 @@ const MODAL_ROUTES_TO_DISMISS: string[] = [
SCREENS.WORKSPACE_AVATAR,
SCREENS.REPORT_AVATAR,
SCREENS.CONCIERGE,
];
]);

const workspaceSplitsWithoutEnteringAnimation = new Set<string>();

Expand Down Expand Up @@ -149,7 +148,7 @@ function handleDismissModalAction(
const lastRoute = state.routes.at(-1);
const newAction = StackActions.pop();

if (!lastRoute?.name || !MODAL_ROUTES_TO_DISMISS.includes(lastRoute?.name)) {
if (!lastRoute?.name || !MODAL_ROUTES_TO_DISMISS.has(lastRoute?.name)) {
Log.hmmm('[Navigation] dismissModal failed because there is no modal stack to dismiss');
return null;
}
Expand Down
7 changes: 3 additions & 4 deletions src/libs/Navigation/Navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,12 @@ import navigationRef from './navigationRef';
import type {NavigationPartialRoute, NavigationRoute, NavigationStateRoute, ReportsSplitNavigatorParamList, RootNavigatorParamList, State} from './types';

// Routes which are part of the flow to set up 2FA
// eslint-disable-next-line unicorn/prefer-set-has
const SET_UP_2FA_ROUTES: Route[] = [
const SET_UP_2FA_ROUTES = new Set<Route>([
ROUTES.REQUIRE_TWO_FACTOR_AUTH,
ROUTES.SETTINGS_2FA_ROOT.getRoute(ROUTES.REQUIRE_TWO_FACTOR_AUTH),
ROUTES.SETTINGS_2FA_VERIFY.getRoute(ROUTES.REQUIRE_TWO_FACTOR_AUTH),
ROUTES.SETTINGS_2FA_SUCCESS.getRoute(ROUTES.REQUIRE_TWO_FACTOR_AUTH),
];
]);

let account: OnyxEntry<Account>;
// We have used `connectWithoutView` here because it is not connected to any UI
Expand Down Expand Up @@ -91,7 +90,7 @@ type CanNavigateParams = {
function canNavigate(methodName: string, params: CanNavigateParams = {}): boolean {
// Block navigation if 2FA is required and the targetRoute is not part of the flow to enable 2FA
const targetRoute = params.route ?? params.backToRoute;
if (shouldShowRequire2FAPage() && targetRoute && !SET_UP_2FA_ROUTES.includes(targetRoute)) {
if (shouldShowRequire2FAPage() && targetRoute && !SET_UP_2FA_ROUTES.has(targetRoute)) {
Log.info(`[Navigation] Blocked navigation because 2FA is required to be set up to access route: ${targetRoute}`);
return false;
}
Expand Down
5 changes: 2 additions & 3 deletions src/libs/ReportActionsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
type MemberChangeMessageElement = MessageTextElement | MemberChangeMessageUserMentionElement | MemberChangeMessageRoomReferenceElement;

let allReportActions: OnyxCollection<ReportActions>;
Onyx.connect({

Check warning on line 60 in src/libs/ReportActionsUtils.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 All @@ -69,7 +69,7 @@
});

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

Check warning on line 72 in src/libs/ReportActionsUtils.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,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -78,14 +78,14 @@
});

let isNetworkOffline = false;
Onyx.connect({

Check warning on line 81 in src/libs/ReportActionsUtils.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.NETWORK,
callback: (val) => (isNetworkOffline = val?.isOffline ?? false),
});

let currentUserAccountID: number | undefined;
let currentEmail = '';
Onyx.connect({

Check warning on line 88 in src/libs/ReportActionsUtils.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.SESSION,
callback: (value) => {
// When signed out, value is undefined
Expand All @@ -99,7 +99,7 @@
});

let privatePersonalDetails: PrivatePersonalDetails | undefined;
Onyx.connect({

Check warning on line 102 in src/libs/ReportActionsUtils.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.PRIVATE_PERSONAL_DETAILS,
callback: (personalDetails) => {
privatePersonalDetails = personalDetails;
Expand Down Expand Up @@ -842,8 +842,7 @@
}

const {POLICY_CHANGE_LOG: policyChangelogTypes, ROOM_CHANGE_LOG: roomChangeLogTypes, ...otherActionTypes} = CONST.REPORT.ACTIONS.TYPE;
// eslint-disable-next-line unicorn/prefer-set-has
const supportedActionTypes: ReportActionName[] = [...Object.values(otherActionTypes), ...Object.values(policyChangelogTypes), ...Object.values(roomChangeLogTypes)];
const supportedActionTypes = new Set<ReportActionName>([...Object.values(otherActionTypes), ...Object.values(policyChangelogTypes), ...Object.values(roomChangeLogTypes)]);

/**
* Checks whether an action is actionable track expense and resolved.
Expand Down Expand Up @@ -878,7 +877,7 @@
}

// Filter out any unsupported reportAction types
if (!supportedActionTypes.includes(reportAction.actionName)) {
if (!supportedActionTypes.has(reportAction.actionName)) {
return false;
}

Expand Down
7 changes: 3 additions & 4 deletions src/libs/SearchQueryUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,12 @@ function buildAmountFilterQuery(filterKey: SearchAmountFilterKeys, filterValues:
*/
function buildFilterValuesString(filterName: string, queryFilters: QueryFilter[]) {
const delimiter = filterName === CONST.SEARCH.SYNTAX_FILTER_KEYS.KEYWORD ? ' ' : ',';
// eslint-disable-next-line unicorn/prefer-set-has
const allowedOps: string[] = [CONST.SEARCH.SYNTAX_OPERATORS.EQUAL_TO, CONST.SEARCH.SYNTAX_OPERATORS.NOT_EQUAL_TO];
const allowedOps = new Set<string>([CONST.SEARCH.SYNTAX_OPERATORS.EQUAL_TO, CONST.SEARCH.SYNTAX_OPERATORS.NOT_EQUAL_TO]);

let filterValueString = '';
queryFilters.forEach((queryFilter, index) => {
const previousValueHasSameOp = allowedOps.includes(queryFilter.operator) && queryFilters?.at(index - 1)?.operator === queryFilter.operator;
const nextValueHasSameOp = allowedOps.includes(queryFilter.operator) && queryFilters?.at(index + 1)?.operator === queryFilter.operator;
const previousValueHasSameOp = allowedOps.has(queryFilter.operator) && queryFilters?.at(index - 1)?.operator === queryFilter.operator;
const nextValueHasSameOp = allowedOps.has(queryFilter.operator) && queryFilters?.at(index + 1)?.operator === queryFilter.operator;

// If the previous queryFilter has the same operator (this rule applies only to eq and neq operators) then append the current value
if (index !== 0 && (previousValueHasSameOp || nextValueHasSameOp)) {
Expand Down
7 changes: 3 additions & 4 deletions src/libs/actions/QueuedOnyxUpdates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ function flushQueue(): Promise<void> {
queuedOnyxUpdates = [];

if (!currentAccountID && !CONFIG.IS_TEST_ENV && !CONFIG.E2E_TESTING) {
// eslint-disable-next-line unicorn/prefer-set-has
const preservedKeys: OnyxKey[] = [
const preservedKeys = new Set<OnyxKey>([
ONYXKEYS.NVP_TRY_NEW_DOT,
ONYXKEYS.NVP_TRY_FOCUS_MODE,
ONYXKEYS.PREFERRED_THEME,
Expand All @@ -50,9 +49,9 @@ function flushQueue(): Promise<void> {
ONYXKEYS.NETWORK,
ONYXKEYS.SHOULD_SHOW_COMPOSE_INPUT,
ONYXKEYS.PRESERVED_USER_SESSION,
];
]);

copyUpdates = copyUpdates.filter((update) => preservedKeys.includes(update.key as OnyxKey));
copyUpdates = copyUpdates.filter((update) => preservedKeys.has(update.key as OnyxKey));
}
return Onyx.update(copyUpdates);
}
Expand Down
7 changes: 3 additions & 4 deletions src/pages/NewChatPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ import ROUTES from '@src/ROUTES';
import type {SelectedParticipant} from '@src/types/onyx/NewGroupChatDraft';
import KeyboardUtils from '@src/utils/keyboard';

// eslint-disable-next-line unicorn/prefer-set-has
const excludedGroupEmails: string[] = CONST.EXPENSIFY_EMAILS.filter((value) => value !== CONST.EMAIL.CONCIERGE);
const excludedGroupEmails = new Set<string>(CONST.EXPENSIFY_EMAILS.filter((value) => value !== CONST.EMAIL.CONCIERGE));

type SelectedOption = ListItem &
Omit<OptionData, 'reportID'> & {
Expand Down Expand Up @@ -290,7 +289,7 @@ function NewChatPage({ref}: NewChatPageProps) {
}
if (selectedOptions.length && option) {
// Prevent excluded emails from being added to groups
if (option?.login && excludedGroupEmails.includes(option.login)) {
if (option?.login && excludedGroupEmails.has(option.login)) {
return;
}
toggleOption(option);
Expand All @@ -317,7 +316,7 @@ function NewChatPage({ref}: NewChatPageProps) {

const itemRightSideComponent = useCallback(
(item: ListItem & Option, isFocused?: boolean) => {
if (!!item.isSelfDM || (item.login && excludedGroupEmails.includes(item.login))) {
if (!!item.isSelfDM || (item.login && excludedGroupEmails.has(item.login))) {
return null;
}

Expand Down
10 changes: 7 additions & 3 deletions src/pages/home/report/ContextMenu/ContextMenuActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -928,11 +928,15 @@ const ContextMenuActions: ContextMenuAction[] = [
},
];

// eslint-disable-next-line unicorn/prefer-set-has
const restrictedReadOnlyActions: TranslationPaths[] = ['reportActionContextMenu.replyInThread', 'reportActionContextMenu.editAction', 'reportActionContextMenu.joinThread', 'common.delete'];
const restrictedReadOnlyActions = new Set<TranslationPaths>([
'reportActionContextMenu.replyInThread',
'reportActionContextMenu.editAction',
'reportActionContextMenu.joinThread',
'common.delete',
]);

const RestrictedReadOnlyContextMenuActions: ContextMenuAction[] = ContextMenuActions.filter(
(action) => 'textTranslateKey' in action && restrictedReadOnlyActions.includes(action.textTranslateKey),
(action) => 'textTranslateKey' in action && restrictedReadOnlyActions.has(action.textTranslateKey),
);

export {RestrictedReadOnlyContextMenuActions};
Expand Down
5 changes: 2 additions & 3 deletions src/pages/settings/Wallet/TransferBalancePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ import type PaymentMethod from '@src/types/onyx/PaymentMethod';
import type {FilterMethodPaymentType} from '@src/types/onyx/WalletTransfer';
import {isEmptyObject} from '@src/types/utils/EmptyObject';

// eslint-disable-next-line unicorn/prefer-set-has
const TRANSFER_TIER_NAMES: string[] = [CONST.WALLET.TIER_NAME.GOLD, CONST.WALLET.TIER_NAME.PLATINUM];
const TRANSFER_TIER_NAMES = new Set<string>([CONST.WALLET.TIER_NAME.GOLD, CONST.WALLET.TIER_NAME.PLATINUM]);

function TransferBalancePage() {
const styles = useThemeStyles();
Expand Down Expand Up @@ -145,7 +144,7 @@ function TransferBalancePage() {
const isButtonDisabled = !isTransferable || !selectedAccount;
const errorMessage = getLatestErrorMessage(walletTransfer);

const shouldShowTransferView = hasExpensifyPaymentMethod(paymentCardList, bankAccountList ?? {}) && TRANSFER_TIER_NAMES.includes(userWallet?.tierName ?? '');
const shouldShowTransferView = hasExpensifyPaymentMethod(paymentCardList, bankAccountList ?? {}) && TRANSFER_TIER_NAMES.has(userWallet?.tierName ?? '');

return (
<ScreenWrapper
Expand Down
11 changes: 7 additions & 4 deletions tests/actions/TourTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,11 @@ describe('actions/Tour', () => {

describe('NewDot users', () => {
const onboardingChoices = Object.values(CONST.ONBOARDING_CHOICES);
// eslint-disable-next-line unicorn/prefer-set-has
const onboardingDemoChoices: OnboardingPurpose[] = [CONST.ONBOARDING_CHOICES.MANAGE_TEAM, CONST.ONBOARDING_CHOICES.TEST_DRIVE_RECEIVER, CONST.ONBOARDING_CHOICES.TRACK_WORKSPACE];
const onboardingDemoChoices = new Set<OnboardingPurpose>([
CONST.ONBOARDING_CHOICES.MANAGE_TEAM,
CONST.ONBOARDING_CHOICES.TEST_DRIVE_RECEIVER,
CONST.ONBOARDING_CHOICES.TRACK_WORKSPACE,
]);
const accountID = 2;
const conciergeChatReport: Report = LHNTestUtils.getFakeReport([accountID, CONST.ACCOUNT_ID.CONCIERGE]);
const testDriveTaskReport: Report = {...LHNTestUtils.getFakeReport(), ownerAccountID: accountID};
Expand Down Expand Up @@ -84,7 +87,7 @@ describe('actions/Tour', () => {
});
};

it.each(onboardingChoices.filter((choice) => onboardingDemoChoices.includes(choice)))('should show the Test Drive demo if user has "%s" onboarding choice', async (choice) => {
it.each(onboardingChoices.filter((choice) => onboardingDemoChoices.has(choice)))('should show the Test Drive demo if user has "%s" onboarding choice', async (choice) => {
await setTestDriveTaskData();

startTestDrive({choice}, false, false);
Expand All @@ -93,7 +96,7 @@ describe('actions/Tour', () => {
expect(Navigation.navigate).toHaveBeenCalledWith(ROUTES.TEST_DRIVE_DEMO_ROOT);
});

it.each(onboardingChoices.filter((choice) => !onboardingDemoChoices.includes(choice)))('should show the Test Drive modal if user has "%s" onboarding choice', async (choice) => {
it.each(onboardingChoices.filter((choice) => !onboardingDemoChoices.has(choice)))('should show the Test Drive modal if user has "%s" onboarding choice', async (choice) => {
startTestDrive({choice}, false, false);
await waitForBatchedUpdates();

Expand Down
Loading