diff --git a/src/ROUTES.ts b/src/ROUTES.ts index 7690fcb16ecc..0f0262456328 100644 --- a/src/ROUTES.ts +++ b/src/ROUTES.ts @@ -13,6 +13,7 @@ import type {EnablePaymentsPageType, EnablePaymentsSubPageType, IOUAction, IOURe import type {ReplacementReason} from './libs/actions/Card'; import type {RootNavigatorParamList} from './libs/Navigation/types'; import type {SearchKey} from './libs/SearchKeyUtils'; +import type {UrlWithParams} from './libs/Url'; import type {Screen} from './SCREENS'; import type {ExpenseRuleFormFieldID} from './types/form/ExpenseRuleForm'; import type {CardFeedWithDomainID, CompanyCardFeedWithDomainID} from './types/onyx'; @@ -4747,7 +4748,7 @@ const ROUTES = { ONBOARDING_PERSONAL_DETAILS: { route: 'onboarding/personal-details', - getRoute: (backTo?: string) => getUrlWithBackToParam(`onboarding/personal-details`, backTo), + getRoute: (backTo?: string): UrlWithParams<'onboarding/personal-details'> => getUrlWithBackToParam(`onboarding/personal-details`, backTo), }, ONBOARDING_PRIVATE_DOMAIN: { route: 'onboarding/private-domain', @@ -4758,22 +4759,22 @@ const ROUTES = { ONBOARDING_EMPLOYEES: { route: 'onboarding/employees', - getRoute: (backTo?: string) => getUrlWithBackToParam(`onboarding/employees`, backTo), + getRoute: (backTo?: string): UrlWithParams<'onboarding/employees'> => getUrlWithBackToParam(`onboarding/employees`, backTo), }, ONBOARDING_ACCOUNTING: { route: 'onboarding/accounting', - getRoute: () => 'onboarding/accounting' as const, + getRoute: (): UrlWithParams<'onboarding/accounting'> => 'onboarding/accounting' as const, }, ONBOARDING_INTERESTED_FEATURES: { route: 'onboarding/interested-features', - getRoute: () => 'onboarding/interested-features' as const, + getRoute: (): UrlWithParams<'onboarding/interested-features'> => 'onboarding/interested-features' as const, }, ONBOARDING_PURPOSE: { route: 'onboarding/purpose', - getRoute: (backTo?: string) => getUrlWithBackToParam(`onboarding/purpose`, backTo), + getRoute: (backTo?: string): UrlWithParams<'onboarding/purpose'> => getUrlWithBackToParam(`onboarding/purpose`, backTo), }, ONBOARDING_WORKSPACES: { route: 'onboarding/join-workspaces', @@ -4799,7 +4800,7 @@ const ROUTES = { route: 'onboarding/personaltrackcase', // eslint-disable-next-line @typescript-eslint/no-deprecated -- Legacy route generation, consistent with other onboarding routes - getRoute: (backTo?: string) => getUrlWithBackToParam(`onboarding/personaltrackcase`, backTo), + getRoute: (backTo?: string): UrlWithParams<'onboarding/personaltrackcase'> => getUrlWithBackToParam(`onboarding/personaltrackcase`, backTo), }, TEST_DRIVE_DEMO_ROOT: 'onboarding/test-drive/demo', AUTO_SUBMIT_MODAL_ROOT: '/auto-submit', diff --git a/src/components/SubStepForms/ConfirmationStep.tsx b/src/components/SubStepForms/ConfirmationStep.tsx index 32190cfc30d0..e00f91953378 100644 --- a/src/components/SubStepForms/ConfirmationStep.tsx +++ b/src/components/SubStepForms/ConfirmationStep.tsx @@ -38,7 +38,7 @@ type SummaryItem = { description: string; /** The answer shown in the row */ - title: string; + title: string | undefined; /** Whether the chevron is shown on the right of the row */ shouldShowRightIcon: boolean; diff --git a/src/hooks/useEnableGlobalReimbursementsNavigation.ts b/src/hooks/useEnableGlobalReimbursementsNavigation.ts index 7daaa8382f95..966e54b01315 100644 --- a/src/hooks/useEnableGlobalReimbursementsNavigation.ts +++ b/src/hooks/useEnableGlobalReimbursementsNavigation.ts @@ -15,7 +15,6 @@ import type {State} from '@libs/Navigation/types'; import ROUTES, {DYNAMIC_ROUTES} from '@src/ROUTES'; import type {Route} from '@src/ROUTES'; -import type {Screen} from '@src/SCREENS'; import {useRoute} from '@react-navigation/native'; @@ -23,7 +22,7 @@ import useRootNavigationState from './useRootNavigationState'; function useEnableGlobalReimbursementsNavigation() { const route = useRoute(); - const isDynamic = isDynamicRouteScreen(route.name as Screen); // eslint-disable-line @typescript-eslint/no-unsafe-type-assertion -- route.name is string at runtime + const isDynamic = isDynamicRouteScreen(route.name); const navigationPath = useRootNavigationState((state) => (isDynamic && state ? getPathFromState(state as State) : undefined)); const dynamicBasePath = isDynamic ? getDynamicBasePathFromNavigationPath(navigationPath) : ''; diff --git a/src/libs/MergeTransactionUtils.ts b/src/libs/MergeTransactionUtils.ts index a74560a916d2..93adf542fac9 100644 --- a/src/libs/MergeTransactionUtils.ts +++ b/src/libs/MergeTransactionUtils.ts @@ -57,6 +57,7 @@ type CommuterExclusionCustomUnitUpdate = {[Key in TupleToUnion; +type DerivedMergeFieldKey = TupleToUnion; type MergeFieldOption = { transaction: Transaction; transactionDetails: TransactionDetails; @@ -71,7 +72,7 @@ type MergeFieldData = { }; /** Type for merge transaction values that can be null to clear existing values in Onyx */ -type MergeTransactionUpdateValues = Partial | null>>; +type MergeTransactionUpdateValues = NullishDeep; const MERGE_FIELD_TRANSLATION_KEYS = { amount: 'iou.amount', @@ -147,7 +148,7 @@ function isEmptyMergeValue(value: unknown) { * @param field - The merge field key to get the value for * @returns The value of the specified field from the transaction */ -function getMergeFieldValue(transactionDetails: TransactionDetails | undefined, transaction: OnyxEntry, field: MergeFieldKey) { +function getMergeFieldValue(transactionDetails: TransactionDetails | undefined, transaction: OnyxEntry, field: DerivedMergeFieldKey) { if (!transactionDetails || !transaction) { return ''; } diff --git a/src/libs/Navigation/helpers/collectScreensWithTabNavigator.ts b/src/libs/Navigation/helpers/collectScreensWithTabNavigator.ts index 611a960ebb04..be899f9d7cdf 100644 --- a/src/libs/Navigation/helpers/collectScreensWithTabNavigator.ts +++ b/src/libs/Navigation/helpers/collectScreensWithTabNavigator.ts @@ -2,7 +2,7 @@ import NAVIGATORS from '@src/NAVIGATORS'; import isDynamicRouteSuffix from './dynamicRoutesUtils/isDynamicRouteSuffix'; -type ScreenConfigEntry = string | {path?: string; screens?: Record}; +type ScreenConfigEntry = undefined | string | {path?: string; screens?: Record}; const navigatorNames = new Set(Object.values(NAVIGATORS) as string[]); diff --git a/src/libs/Navigation/helpers/dynamicRoutesUtils/getDynamicRouteAdaptedState.ts b/src/libs/Navigation/helpers/dynamicRoutesUtils/getDynamicRouteAdaptedState.ts index 5316487b571e..a09036178e5a 100644 --- a/src/libs/Navigation/helpers/dynamicRoutesUtils/getDynamicRouteAdaptedState.ts +++ b/src/libs/Navigation/helpers/dynamicRoutesUtils/getDynamicRouteAdaptedState.ts @@ -2,7 +2,6 @@ import findFocusedRouteWithOnyxTabGuard from '@libs/Navigation/helpers/findFocus import getStateFromPath from '@libs/Navigation/helpers/getStateFromPath'; import type {Route} from '@src/ROUTES'; -import type {Screen} from '@src/SCREENS'; import SCREENS from '@src/SCREENS'; import type {NavigationState, PartialState} from '@react-navigation/native'; @@ -113,7 +112,7 @@ function getDynamicRouteAdaptedState(state: PartialState, focus currentPath = resolvedBasePath; newFocused = findFocusedRouteWithOnyxTabGuard(resolvedBaseState); - } while (!!newFocused && isDynamicRouteScreen(newFocused.name as Screen)); + } while (!!newFocused && isDynamicRouteScreen(newFocused.name)); return accumulatedState; } diff --git a/src/libs/Navigation/helpers/dynamicRoutesUtils/isDynamicRouteScreen.ts b/src/libs/Navigation/helpers/dynamicRoutesUtils/isDynamicRouteScreen.ts index 9251a684edff..c5d6b82a8c44 100644 --- a/src/libs/Navigation/helpers/dynamicRoutesUtils/isDynamicRouteScreen.ts +++ b/src/libs/Navigation/helpers/dynamicRoutesUtils/isDynamicRouteScreen.ts @@ -1,7 +1,5 @@ import {normalizedConfigs} from '@libs/Navigation/linkingConfig/config'; -import type {Screen} from '@src/SCREENS'; - import {dynamicRoutePaths} from './isDynamicRouteSuffix'; /** @@ -9,7 +7,7 @@ import {dynamicRoutePaths} from './isDynamicRouteSuffix'; * @param screenName - The name of the screen to check. * @returns True if the screen name is a dynamic route screen, false otherwise. */ -function isDynamicRouteScreen(screenName: Screen): boolean { +function isDynamicRouteScreen(screenName: string): boolean { const screenPath = normalizedConfigs[screenName]?.path; if (!screenPath) { diff --git a/src/libs/Navigation/helpers/getOnboardingRouteFromScreen.ts b/src/libs/Navigation/helpers/getOnboardingRouteFromScreen.ts index 5a67dbd10b5a..5d45e2c19594 100644 --- a/src/libs/Navigation/helpers/getOnboardingRouteFromScreen.ts +++ b/src/libs/Navigation/helpers/getOnboardingRouteFromScreen.ts @@ -1,20 +1,30 @@ import type {OnboardingScreen} from '@libs/getOnboardingStepCounter'; -import {normalizedConfigs} from '@libs/Navigation/linkingConfig/config'; import {getUrlWithParams} from '@libs/Url'; +import ROUTES from '@src/ROUTES'; import type {Route} from '@src/ROUTES'; +import SCREENS from '@src/SCREENS'; -function getOnboardingRouteFromScreen(screen: OnboardingScreen, backTo?: string): Route | undefined { - const path = normalizedConfigs[screen]?.path; - if (!path) { - return undefined; - } +const onboardingRoutes = { + [SCREENS.ONBOARDING.PERSONAL_DETAILS]: ROUTES.ONBOARDING_PERSONAL_DETAILS.route, + [SCREENS.ONBOARDING.PRIVATE_DOMAIN]: ROUTES.ONBOARDING_PRIVATE_DOMAIN.route, + [SCREENS.ONBOARDING.EMPLOYEES]: ROUTES.ONBOARDING_EMPLOYEES.route, + [SCREENS.ONBOARDING.ACCOUNTING]: ROUTES.ONBOARDING_ACCOUNTING.route, + [SCREENS.ONBOARDING.INTERESTED_FEATURES]: ROUTES.ONBOARDING_INTERESTED_FEATURES.route, + [SCREENS.ONBOARDING.PURPOSE]: ROUTES.ONBOARDING_PURPOSE.route, + [SCREENS.ONBOARDING.WORKSPACES]: ROUTES.ONBOARDING_WORKSPACES.route, + [SCREENS.ONBOARDING.WORK_EMAIL]: ROUTES.ONBOARDING_WORK_EMAIL.route, + [SCREENS.ONBOARDING.WORK_EMAIL_VALIDATION]: ROUTES.ONBOARDING_WORK_EMAIL_VALIDATION.route, + [SCREENS.ONBOARDING.PERSONAL_TRACK_GOAL]: ROUTES.ONBOARDING_PERSONAL_TRACK_GOAL.route, +} satisfies Record; +function getOnboardingRouteFromScreen(screen: OnboardingScreen, backTo?: string): Route { + // The onboarding getters in ROUTES are typed to allow a query, so the route with `backTo` is still a Route. if (backTo) { - return getUrlWithParams(path, {backTo}) as Route; + return getUrlWithParams(onboardingRoutes[screen], {backTo}); } - return path as Route; + return onboardingRoutes[screen]; } export default getOnboardingRouteFromScreen; diff --git a/src/libs/Navigation/linkingConfig/config.ts b/src/libs/Navigation/linkingConfig/config.ts index a924505f021a..c92704423323 100644 --- a/src/libs/Navigation/linkingConfig/config.ts +++ b/src/libs/Navigation/linkingConfig/config.ts @@ -1,5 +1,4 @@ import collectScreensWithTabNavigator from '@libs/Navigation/helpers/collectScreensWithTabNavigator'; -import type {ScreenConfigEntry} from '@libs/Navigation/helpers/collectScreensWithTabNavigator'; import type {RouteConfig} from '@libs/Navigation/helpers/createNormalizedConfigs'; import createNormalizedConfigs from '@libs/Navigation/helpers/createNormalizedConfigs'; @@ -8,7 +7,6 @@ import type {RootNavigatorParamList} from '@navigation/types'; import CONST from '@src/CONST'; import NAVIGATORS from '@src/NAVIGATORS'; import ROUTES, {DYNAMIC_ROUTES} from '@src/ROUTES'; -import type {Screen} from '@src/SCREENS'; import SCREENS from '@src/SCREENS'; import EXPENSE_RULE_INPUT_IDS from '@src/types/form/ExpenseRuleForm'; @@ -2639,18 +2637,11 @@ const normalizedConfigs = Object.keys(config.screens) ), ) .flat() - .reduce( - (acc, route) => { - acc[route.screen as Screen] = route; - return acc; - }, - {} as Record, - ); + .reduce>((acc, route) => { + acc[route.screen] = route; + return acc; + }, {}); -const { - screensWithTabNavigator: screensWithOnyxTabNavigator, - dynamicTabPatternToTabPaths, - dynamicTabScreensByHost, -} = collectScreensWithTabNavigator(config.screens as Record); +const {screensWithTabNavigator: screensWithOnyxTabNavigator, dynamicTabPatternToTabPaths, dynamicTabScreensByHost} = collectScreensWithTabNavigator(config.screens); export {normalizedConfigs, config, screensWithOnyxTabNavigator, dynamicTabPatternToTabPaths, dynamicTabScreensByHost}; diff --git a/src/libs/Url.ts b/src/libs/Url.ts index 60a1335cca9d..ba5364b67760 100644 --- a/src/libs/Url.ts +++ b/src/libs/Url.ts @@ -173,3 +173,5 @@ export { getUrlWithParams, hasSecureLinkKey, }; + +export type {UrlWithParams}; diff --git a/src/libs/actions/MergeTransaction.ts b/src/libs/actions/MergeTransaction.ts index fcbfa7ec851c..86ea05d6d40b 100644 --- a/src/libs/actions/MergeTransaction.ts +++ b/src/libs/actions/MergeTransaction.ts @@ -13,7 +13,7 @@ import { selectTargetAndSourceTransactionsForMerge, shouldNavigateToReceiptReview, } from '@libs/MergeTransactionUtils'; -import type {MergeFieldKey, MergeTransactionUpdateValues} from '@libs/MergeTransactionUtils'; +import type {MergeTransactionUpdateValues} from '@libs/MergeTransactionUtils'; import createDynamicRoute from '@libs/Navigation/helpers/dynamicRoutesUtils/createDynamicRoute'; import findAllMatchingDynamicSuffixes from '@libs/Navigation/helpers/dynamicRoutesUtils/findAllMatchingDynamicSuffixes'; import getPathWithoutDynamicSuffix from '@libs/Navigation/helpers/dynamicRoutesUtils/getPathWithoutDynamicSuffix'; @@ -49,7 +49,7 @@ import type { TransactionViolations, } from '@src/types/onyx'; -import type {OnyxCollection, OnyxEntry, OnyxMergeInput, OnyxUpdate} from 'react-native-onyx'; +import type {OnyxCollection, OnyxEntry, OnyxUpdate} from 'react-native-onyx'; import {deepEqual} from 'fast-equals'; import Onyx from 'react-native-onyx'; @@ -71,7 +71,7 @@ function setupMergeTransactionData(transactionID: string, values: Partial); + Onyx.merge(`${ONYXKEYS.COLLECTION.MERGE_TRANSACTION}${transactionID}`, values); } const MERGE_TRANSACTION_DYNAMIC_PATHS: ReadonlySet = new Set([ @@ -349,11 +349,12 @@ function getOnyxTargetTransactionData({ const targetTransactionDetails = getTransactionDetails(targetTransaction); const filteredTransactionChanges = Object.fromEntries( Object.entries(mergeTransaction).filter(([key, mergeValue]) => { - if (!(DERIVED_MERGE_FIELDS as readonly string[]).includes(key)) { + const field = DERIVED_MERGE_FIELDS.find((derivedField) => derivedField === key); + if (!field) { return false; } - const targetValue = getMergeFieldValue(targetTransactionDetails, targetTransaction, key as MergeFieldKey); + const targetValue = getMergeFieldValue(targetTransactionDetails, targetTransaction, field); return !deepEqual(mergeValue, targetValue); }), diff --git a/src/pages/ReimbursementAccount/NonUSD/BankInfo/subSteps/Confirmation.tsx b/src/pages/ReimbursementAccount/NonUSD/BankInfo/subSteps/Confirmation.tsx index c5a4eecab11d..d7e5b9240df8 100644 --- a/src/pages/ReimbursementAccount/NonUSD/BankInfo/subSteps/Confirmation.tsx +++ b/src/pages/ReimbursementAccount/NonUSD/BankInfo/subSteps/Confirmation.tsx @@ -20,6 +20,8 @@ import {SafeString} from 'expensify-common'; import React from 'react'; const {ACCOUNT_HOLDER_COUNTRY} = INPUT_IDS.ADDITIONAL_DATA.CORPAY; +// The country code comes from form data, so read the names as a map where the code can be missing. +const countryNames: Partial> = CONST.ALL_COUNTRIES; function Confirmation({onNext, onMove, isEditing, corpayFields}: BankInfoSubStepProps) { const {translate} = useLocalize(); const styles = useThemeStyles(); @@ -31,10 +33,10 @@ function Confirmation({onNext, onMove, isEditing, corpayFields}: BankInfoSubStep const values = getBankInfoStepValues(inputKeys, reimbursementAccountDraft, reimbursementAccount); const summaryItems = (formFields ?? []).map((field) => { - let title = SafeString(values[field.id as keyof typeof values]); + let title: string | undefined = SafeString(values[inputKeys[field.id]]); if (field.id === ACCOUNT_HOLDER_COUNTRY) { - title = CONST.ALL_COUNTRIES[title as keyof typeof CONST.ALL_COUNTRIES]; + title = countryNames[title]; } return { diff --git a/src/pages/ReimbursementAccount/NonUSD/utils/getInitialSubStepForBusinessInfoStep.ts b/src/pages/ReimbursementAccount/NonUSD/utils/getInitialSubStepForBusinessInfoStep.ts index b2c40453e8a7..ad1697c7ce7a 100644 --- a/src/pages/ReimbursementAccount/NonUSD/utils/getInitialSubStepForBusinessInfoStep.ts +++ b/src/pages/ReimbursementAccount/NonUSD/utils/getInitialSubStepForBusinessInfoStep.ts @@ -11,11 +11,34 @@ import { import CONST from '@src/CONST'; import INPUT_IDS from '@src/types/form/ReimbursementAccountForm'; +import type {ReimbursementAccountForm} from '@src/types/form/ReimbursementAccountForm'; import {Str} from 'expensify-common'; const BUSINESS_INFO_STEP_KEYS = INPUT_IDS.ADDITIONAL_DATA.CORPAY; +type BusinessInfoData = Pick< + ReimbursementAccountForm, + | typeof BUSINESS_INFO_STEP_KEYS.COMPANY_NAME + | typeof BUSINESS_INFO_STEP_KEYS.COMPANY_WEBSITE + | typeof BUSINESS_INFO_STEP_KEYS.COMPANY_STREET + | typeof BUSINESS_INFO_STEP_KEYS.COMPANY_CITY + | typeof BUSINESS_INFO_STEP_KEYS.COMPANY_POSTAL_CODE + | typeof BUSINESS_INFO_STEP_KEYS.COMPANY_STATE + | typeof BUSINESS_INFO_STEP_KEYS.COMPANY_COUNTRY_CODE + | typeof BUSINESS_INFO_STEP_KEYS.BUSINESS_CONTACT_NUMBER + | typeof BUSINESS_INFO_STEP_KEYS.BUSINESS_CONFIRMATION_EMAIL + | typeof BUSINESS_INFO_STEP_KEYS.BUSINESS_REGISTRATION_INCORPORATION_NUMBER + | typeof BUSINESS_INFO_STEP_KEYS.TAX_ID_EIN_NUMBER + | typeof BUSINESS_INFO_STEP_KEYS.FORMATION_INCORPORATION_COUNTRY_CODE + | typeof BUSINESS_INFO_STEP_KEYS.FORMATION_INCORPORATION_STATE + | typeof BUSINESS_INFO_STEP_KEYS.BUSINESS_CATEGORY + | typeof BUSINESS_INFO_STEP_KEYS.APPLICANT_TYPE_ID + | typeof BUSINESS_INFO_STEP_KEYS.ANNUAL_VOLUME + | typeof BUSINESS_INFO_STEP_KEYS.TRADE_VOLUME +>; +type BusinessCountry = ReimbursementAccountForm[typeof BUSINESS_INFO_STEP_KEYS.COMPANY_COUNTRY_CODE]; + function isMissingValidCompanyName(companyName: string) { return companyName === '' || !isValidCompanyName(companyName); } @@ -41,18 +64,18 @@ function isMissingValidBusinessContactInformation(contactNumber: string, contact return contactNumber === '' || contactEmail === '' || !isValidPhoneInternational(contactNumber) || !isValidEmail(contactEmail); } -function isMissingValidRegistrationNumber(registrationNumber: string, country: string) { - return registrationNumber === '' || !isValidRegistrationNumber(registrationNumber, country as keyof typeof CONST.COUNTRY); +function isMissingValidRegistrationNumber(registrationNumber: string, country: BusinessCountry) { + return registrationNumber === '' || !isValidRegistrationNumber(registrationNumber, country); } -function isMissingValidTaxIDEINNumber(taxIDEINNumber: string, country: string) { - return taxIDEINNumber === '' || !isValidTaxIDEINNumber(taxIDEINNumber, country as keyof typeof CONST.COUNTRY); +function isMissingValidTaxIDEINNumber(taxIDEINNumber: string, country: BusinessCountry) { + return taxIDEINNumber === '' || !isValidTaxIDEINNumber(taxIDEINNumber, country); } /** * Returns the initial subStep for the Business info step based on already existing data */ -function getInitialSubStepForBusinessInfoStep(data: Record): number { +function getInitialSubStepForBusinessInfoStep(data: BusinessInfoData): number { if (isMissingValidCompanyName(data[BUSINESS_INFO_STEP_KEYS.COMPANY_NAME])) { return 0; } diff --git a/src/pages/workspace/rules/MerchantRules/useMerchantRuleRoute.ts b/src/pages/workspace/rules/MerchantRules/useMerchantRuleRoute.ts index 34c44c3d0c68..8b4ebe79ce8f 100644 --- a/src/pages/workspace/rules/MerchantRules/useMerchantRuleRoute.ts +++ b/src/pages/workspace/rules/MerchantRules/useMerchantRuleRoute.ts @@ -5,7 +5,6 @@ import isDynamicRouteScreen from '@libs/Navigation/helpers/dynamicRoutesUtils/is import type {DynamicRouteSuffix, Route} from '@src/ROUTES'; import ROUTES from '@src/ROUTES'; -import type {Screen} from '@src/SCREENS'; import {useRoute} from '@react-navigation/native'; @@ -43,8 +42,7 @@ type MerchantRuleRoute = { function useMerchantRuleRoute(dynamicSuffix: DynamicRouteSuffix, policyID: string, ruleID?: string, staticBackToRoute?: Route): MerchantRuleRoute { const route = useRoute(); // Asking the linking config avoids a list here that could drift as screens are added. - // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- useRoute is untyped here because this hook is shared by every page of the flow, and the repo's other isDynamicRouteScreen callers narrow the same way - const isCreatedFromExpense = isDynamicRouteScreen(route.name as Screen); + const isCreatedFromExpense = isDynamicRouteScreen(route.name); // Only workspace settings can reach an edit. `ruleID` is absent on dynamic routes, and `undefined !== 'new'` // would otherwise read as editing. const isEditing = !isCreatedFromExpense && !!ruleID && ruleID !== ROUTES.NEW; diff --git a/tests/unit/getOnboardingRouteFromScreenTest.ts b/tests/unit/getOnboardingRouteFromScreenTest.ts index 82c72db37133..1339a3f09f30 100644 --- a/tests/unit/getOnboardingRouteFromScreenTest.ts +++ b/tests/unit/getOnboardingRouteFromScreenTest.ts @@ -1,5 +1,4 @@ import getOnboardingRouteFromScreen from '@libs/Navigation/helpers/getOnboardingRouteFromScreen'; -import {normalizedConfigs} from '@libs/Navigation/linkingConfig/config'; import ROUTES from '@src/ROUTES'; import SCREENS from '@src/SCREENS'; @@ -9,19 +8,6 @@ describe('getOnboardingRouteFromScreen', () => { expect(getOnboardingRouteFromScreen(SCREENS.ONBOARDING.EMPLOYEES)).toBe(ROUTES.ONBOARDING_EMPLOYEES.route); }); - it('returns undefined for screens without a linking config path', () => { - const screen = SCREENS.ONBOARDING.EMPLOYEES; - const config = normalizedConfigs[screen]; - - Reflect.deleteProperty(normalizedConfigs, screen); - - try { - expect(getOnboardingRouteFromScreen(screen)).toBeUndefined(); - } finally { - normalizedConfigs[screen] = config; - } - }); - it('matches ROUTES.getRoute when backTo is provided', () => { const backTo = ROUTES.ONBOARDING_PERSONAL_DETAILS.getRoute();