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
2 changes: 1 addition & 1 deletion Mobile-Expensify
8 changes: 4 additions & 4 deletions src/components/Navigation/QuickCreationActionsBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,13 @@ import getCreateReportRoute, {getReportsRootRoute, navigateToCreateReportWorkspa
import Navigation from '@libs/Navigation/Navigation';
import {openTravelDotLink} from '@libs/openTravelDotLink';
import Permissions from '@libs/Permissions';
import {getDefaultChatEnabledPolicy, isPaidGroupPolicy} from '@libs/PolicyUtils';
import {getDefaultChatEnabledPolicy, getGroupPoliciesWhereReportCanBeCreated, isPaidGroupPolicy} from '@libs/PolicyUtils';
import {generateReportID, hasViolations as hasViolationsReportUtils} from '@libs/ReportUtils';
import {shouldRestrictUserBillableActions} from '@libs/SubscriptionUtils';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import {primaryLoginSelector} from '@src/selectors/Account';
import {groupPaidPoliciesWithExpenseChatEnabledSelector} from '@src/selectors/Policy';
import type * as OnyxTypes from '@src/types/onyx';

function QuickCreationActionsBar() {
Expand Down Expand Up @@ -57,8 +56,9 @@ function QuickCreationActionsBar() {
const hasViolations = hasViolationsReportUtils(undefined, transactionViolations, session?.accountID ?? CONST.DEFAULT_NUMBER_ID, session?.email ?? '');
const {policyForMovingExpensesID, shouldSelectPolicy} = usePolicyForMovingExpenses();
const shouldNavigateToUpgradePath = !policyForMovingExpensesID && !shouldSelectPolicy;
const groupPaidPoliciesWithChatEnabledSelector = useCallback((policies: OnyxCollection<OnyxTypes.Policy>) => groupPaidPoliciesWithExpenseChatEnabledSelector(policies, email), [email]);
const [groupPoliciesWithChatEnabled = CONST.EMPTY_ARRAY] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {selector: groupPaidPoliciesWithChatEnabledSelector}, [email]);
const isSubmit2026BetaEnabled = isBetaEnabled(CONST.BETAS.SUBMIT_2026);
const groupPoliciesWithChatEnabledSelector = (policies: OnyxCollection<OnyxTypes.Policy>) => getGroupPoliciesWhereReportCanBeCreated(policies, isSubmit2026BetaEnabled, email);
const [groupPoliciesWithChatEnabled = CONST.EMPTY_ARRAY] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {selector: groupPoliciesWithChatEnabledSelector}, [email, isSubmit2026BetaEnabled]);

const defaultChatEnabledPolicy = useMemo(
() => getDefaultChatEnabledPolicy(groupPoliciesWithChatEnabled as Array<OnyxEntry<OnyxTypes.Policy>>, activePolicy),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,12 @@ import interceptAnonymousUser from '@libs/interceptAnonymousUser';
import createDynamicRoute from '@libs/Navigation/helpers/dynamicRoutesUtils/createDynamicRoute';
import isSearchTopmostFullScreenRoute from '@libs/Navigation/helpers/isSearchTopmostFullScreenRoute';
import Navigation from '@libs/Navigation/Navigation';
import {getDefaultChatEnabledPolicy} from '@libs/PolicyUtils';
import {getDefaultChatEnabledPolicy, getGroupPoliciesWhereReportCanBeCreated} from '@libs/PolicyUtils';
import {generateReportID, hasViolations as hasViolationsReportUtils} from '@libs/ReportUtils';
import {shouldRestrictUserBillableActions} from '@libs/SubscriptionUtils';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES, {DYNAMIC_ROUTES} from '@src/ROUTES';
import {groupPaidPoliciesWithExpenseChatEnabledSelector} from '@src/selectors/Policy';
import type * as OnyxTypes from '@src/types/onyx';

function SearchActionsBarCreateButton() {
Expand All @@ -47,11 +46,12 @@ function SearchActionsBarCreateButton() {
const [allBetas] = useOnyx(ONYXKEYS.BETAS);
const [transactionViolations] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS);
const [draftTransactionIDs] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_DRAFT, {selector: validTransactionDraftIDsSelector});
const groupPaidPoliciesWithChatEnabledSelector = useCallback((policies: OnyxCollection<OnyxTypes.Policy>) => groupPaidPoliciesWithExpenseChatEnabledSelector(policies, email), [email]);
const [groupPoliciesWithChatEnabled = CONST.EMPTY_ARRAY] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {selector: groupPaidPoliciesWithChatEnabledSelector}, [email]);
const currentUserPersonalDetails = useCurrentUserPersonalDetails();
const {isBetaEnabled} = usePermissions();
const isASAPSubmitBetaEnabled = isBetaEnabled(CONST.BETAS.ASAP_SUBMIT);
const isSubmit2026BetaEnabled = isBetaEnabled(CONST.BETAS.SUBMIT_2026);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

❌ CLEAN-REACT-PATTERNS-0 (docs)

React Compiler is enabled and this file compiles successfully. The useCallback wrapping the selector is redundant because the compiler automatically memoizes closures based on their captured variables (isSubmit2026BetaEnabled, email).

Remove the useCallback wrapper and define the selector as a plain function expression:

const groupPoliciesWithChatEnabledSelector = (policies: OnyxCollection<OnyxTypes.Policy>) => getGroupPoliciesWhereReportCanBeCreated(policies, isSubmit2026BetaEnabled, email);

Reviewed at: f68b2a5 | Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Changed

const groupPoliciesWithChatEnabledSelector = (policies: OnyxCollection<OnyxTypes.Policy>) => getGroupPoliciesWhereReportCanBeCreated(policies, isSubmit2026BetaEnabled, email);
const [groupPoliciesWithChatEnabled = CONST.EMPTY_ARRAY] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {selector: groupPoliciesWithChatEnabledSelector}, [email, isSubmit2026BetaEnabled]);
const currentUserPersonalDetails = useCurrentUserPersonalDetails();
const hasViolations = hasViolationsReportUtils(undefined, transactionViolations, session?.accountID ?? CONST.DEFAULT_NUMBER_ID, session?.email ?? '');
const [activePolicyID] = useOnyx(ONYXKEYS.NVP_ACTIVE_POLICY_ID);
const [activePolicy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${activePolicyID}`);
Expand Down
24 changes: 23 additions & 1 deletion src/libs/PolicyUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2113,6 +2113,27 @@ function getGroupPaidPoliciesWithExpenseChatEnabled(policies: OnyxCollection<Pol
);
}

/**
* Returns the group workspaces where the user can create a report: paid (Team/Corporate) workspaces,
* plus Submit workspaces when the SUBMIT_2026 beta is enabled. Submit workspaces are free but still
* support report creation, so they belong here even though they're excluded from
* `getGroupPaidPoliciesWithExpenseChatEnabled`.
*
* @param isSubmit2026BetaEnabled - Prefer `isBetaEnabled(CONST.BETAS.SUBMIT_2026)` from `usePermissions()`, not raw betas from Onyx.
*/
function getGroupPoliciesWhereReportCanBeCreated(policies: OnyxCollection<Policy> | null, isSubmit2026BetaEnabled: boolean, currentUserLogin?: string) {
if (isEmptyObject(policies)) {
return CONST.EMPTY_ARRAY;
}
return Object.values(policies).filter(
(policy): policy is Policy =>
!!policy?.isPolicyExpenseChatEnabled &&
!policy?.isJoinRequestPending &&
(isPaidGroupPolicy(policy) || canAccessSubmitWorkspaceFeatures(policy, isSubmit2026BetaEnabled)) &&
shouldShowPolicy(policy, false, currentUserLogin),
);
}

/**
* This method checks if the active policy has expense chat enabled and is a paid group policy.
* If true, it returns the active policy itself, else it returns the first policy from groupPoliciesWithChatEnabled.
Expand All @@ -2121,7 +2142,7 @@ function getGroupPaidPoliciesWithExpenseChatEnabled(policies: OnyxCollection<Pol
* and the user would be taken to the workspace selection page.
*/
function getDefaultChatEnabledPolicy(groupPoliciesWithChatEnabled: Array<OnyxInputOrEntry<Policy>>, activePolicy?: OnyxInputOrEntry<Policy> | null): OnyxInputOrEntry<Policy> | undefined {
if (activePolicy && activePolicy.isPolicyExpenseChatEnabled && isPaidGroupPolicy(activePolicy)) {
if (activePolicy && activePolicy.isPolicyExpenseChatEnabled && isGroupPolicy(activePolicy)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Gate active Submit policies before defaulting

When the active workspace is a Submit policy but the user is not in SUBMIT_2026, this now returns that active policy even though callers just filtered groupPoliciesWithChatEnabled through getGroupPoliciesWhereReportCanBeCreated. For a user who has an active Submit workspace plus any eligible paid workspace, the report buttons will create the report in the beta-gated Submit workspace instead of using the eligible paid workspace or showing the selector; keep the active-policy default aligned with the same Submit beta eligibility as the list.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No need since users won't be able to create the workspace if they are not in the beta

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 Gate the active policy by the Submit beta

When SUBMIT_2026 is disabled, the updated callers build groupPoliciesWithChatEnabled with getGroupPoliciesWhereReportCanBeCreated(..., false), which excludes Submit workspaces, but this branch still returns the active workspace because isGroupPolicy() includes Submit unconditionally. With a Submit workspace selected, the create-report flows then use this defaultChatEnabledPolicy to call createNewReport, bypassing the intended beta gate. Please apply the same Submit-beta check to the active-policy path (or require the active policy to be present in the already filtered list).

Useful? React with 👍 / 👎.

return activePolicy;
}

Expand Down Expand Up @@ -2495,6 +2516,7 @@ export {
areSettingsInErrorFields,
settingsPendingAction,
getGroupPaidPoliciesWithExpenseChatEnabled,
getGroupPoliciesWhereReportCanBeCreated,
getDefaultChatEnabledPolicy,
getForwardsToAccount,
getSubmitToAccountID,
Expand Down
26 changes: 9 additions & 17 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ import {
hasDependentTags as hasDependentTagsPolicyUtils,
hasDynamicExternalWorkflow,
isExpensifyTeam,
isGroupPolicy as isGroupPolicyPolicyUtils,
isInstantSubmitEnabled,
isPaidGroupPolicy as isPaidGroupPolicyPolicyUtils,
isPendingDeletePolicy,
Expand Down Expand Up @@ -1741,18 +1742,10 @@ function isCurrentUserInvoiceReceiver(report: OnyxEntry<Report>): boolean {
}

/**
* Whether the provided policyType is a Free, Collect or Control policy type
*/
function isGroupPolicy(policyType: string): boolean {
return policyType === CONST.POLICY.TYPE.CORPORATE || policyType === CONST.POLICY.TYPE.TEAM;
}

/**
* Whether the provided report belongs to a Free, Collect or Control policy
* Whether the provided report belongs to a paid group or Submit policy
*/
function isReportInGroupPolicy(report: OnyxInputOrEntry<Report>, policy?: OnyxInputOrEntry<Policy>): boolean {
const policyType = policy?.type ?? getPolicyType(report, allPolicies);
return isGroupPolicy(policyType);
return isGroupPolicyPolicyUtils(policy ?? allPolicies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID}`]);
}

/**
Expand Down Expand Up @@ -1978,7 +1971,7 @@ function shouldEnableNegative(report: OnyxEntry<Report>, policy?: OnyxEntry<Poli
const isFirstTimeCreatingReport = !report && !policy && iouType === CONST.IOU.TYPE.SUBMIT && !isUserInRecipients;

const isExpenseReportType = isExpenseReport(report);
const isGroupPolicyType = isGroupPolicy(policy?.type ?? '');
const isGroupPolicyType = isGroupPolicyPolicyUtils(policy);
const isCreatingNewIOU = iouType === CONST.IOU.TYPE.CREATE && !(isNewManualExpenseFlow && isUserInRecipients);
const supportsNegativeAmounts = isExpenseReportType || isGroupPolicyType || isSelfDMReport || isCreatingNewIOU || isFirstTimeCreatingReport;

Expand Down Expand Up @@ -2792,7 +2785,7 @@ function canAddTransaction(moneyRequestReport: OnyxEntry<Report>, isReportArchiv
// This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850
const policy = getPolicy(moneyRequestReport?.policyID);

if (isExpenseReport(moneyRequestReport) && (!isCurrentUserSubmitter(moneyRequestReport) || !isPaidGroupPolicyPolicyUtils(policy))) {
if (isExpenseReport(moneyRequestReport) && (!isCurrentUserSubmitter(moneyRequestReport) || !isGroupPolicyPolicyUtils(policy))) {
return false;
}

Expand Down Expand Up @@ -6297,9 +6290,9 @@ function getParsedComment(text: string, parsingDetails?: ParsingDetails, mediaAt

if (parsingDetails?.policyID) {
// This will be fixed as part of https://github.com/Expensify/Expensify/issues/507850
const policyType = getPolicy(parsingDetails?.policyID)?.type;
if (policyType) {
isGroupPolicyReport = isGroupPolicy(policyType);
const policy = getPolicy(parsingDetails?.policyID);
if (policy?.type) {
isGroupPolicyReport = isGroupPolicyPolicyUtils(policy);
}
}

Expand Down Expand Up @@ -6735,7 +6728,7 @@ function buildOptimisticInvoiceReport(
* Computes the optimistic report name using the policy's title field formula, with a fallback to the default expense report name.
*/
function computeOptimisticReportName(report: Report, policy: OnyxEntry<Policy>, policyID: string | undefined, reportTransactions: Record<string, Transaction>): string | null {
if (!isGroupPolicy(policy?.type ?? '')) {
if (!isGroupPolicyPolicyUtils(policy)) {
return null;
}

Expand Down Expand Up @@ -13466,7 +13459,6 @@ export {
isGroupChat,
isGroupChatAdmin,
isHarvestCreatedExpenseReport,
isGroupPolicy,
isReportInGroupPolicy,
isHoldCreator,
isIOUOwnedByCurrentUser,
Expand Down
5 changes: 3 additions & 2 deletions src/pages/Search/EmptySearchView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {createNewReport} from '@libs/actions/Report';
import {startTestDrive} from '@libs/actions/Tour';
import interceptAnonymousUser from '@libs/interceptAnonymousUser';
import Navigation from '@libs/Navigation/Navigation';
import {canSendInvoice, getDefaultChatEnabledPolicy, getGroupPaidPoliciesWithExpenseChatEnabled} from '@libs/PolicyUtils';
import {canSendInvoice, getDefaultChatEnabledPolicy, getGroupPoliciesWhereReportCanBeCreated} from '@libs/PolicyUtils';
import {generateReportID, hasViolations as hasViolationsReportUtils} from '@libs/ReportUtils';
import {isDefaultExpenseReportsQuery, isDefaultExpensesQuery} from '@libs/SearchQueryUtils';
import type {SearchTypeMenuSection} from '@libs/SearchUIUtils';
Expand Down Expand Up @@ -71,13 +71,14 @@ type EmptySearchViewItem = {
function EmptySearchView({similarSearchHash, type, hasResults, queryJSON, onScroll, contentContainerStyle}: EmptySearchViewProps) {
const currentUserPersonalDetails = useCurrentUserPersonalDetails();
const {typeMenuSections} = useSearchTypeMenuSections();
const {isBetaEnabled} = usePermissions();

const [allPolicies] = useOnyx(ONYXKEYS.COLLECTION.POLICY);

const [activePolicyID] = useOnyx(ONYXKEYS.NVP_ACTIVE_POLICY_ID);
const [activePolicy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${activePolicyID}`);

const groupPoliciesWithChatEnabled = getGroupPaidPoliciesWithExpenseChatEnabled(allPolicies);
const groupPoliciesWithChatEnabled = getGroupPoliciesWhereReportCanBeCreated(allPolicies, isBetaEnabled(CONST.BETAS.SUBMIT_2026));

const [hasSeenTour = false] = useOnyx(ONYXKEYS.NVP_ONBOARDING, {
selector: hasSeenTourSelector,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import useResponsiveLayout from '@hooks/useResponsiveLayout';
import {createNewReport} from '@libs/actions/Report';
import getCreateReportRoute, {getReportsRootRoute, navigateToCreateReportWorkspaceSelection} from '@libs/Navigation/helpers/getCreateReportRoute';
import Navigation from '@libs/Navigation/Navigation';
import {getDefaultChatEnabledPolicy, isPaidGroupPolicy, shouldShowPolicy} from '@libs/PolicyUtils';
import {getDefaultChatEnabledPolicy, isGroupPolicy, shouldShowPolicy} from '@libs/PolicyUtils';
import {hasViolations as hasViolationsReportUtils} from '@libs/ReportUtils';
import isOnSearchMoneyRequestReportPage from '@navigation/helpers/isOnSearchMoneyRequestReportPage';
import FABFocusableMenuItem from '@pages/inbox/sidebar/FABPopoverContent/FABFocusableMenuItem';
Expand All @@ -30,7 +30,7 @@ const chatEnabledPaidGroupPoliciesSelector = (policies: OnyxCollection<OnyxTypes
}
const result: OnyxTypes.Policy[] = [];
for (const policy of Object.values(policies)) {
if (!policy?.isPolicyExpenseChatEnabled || policy?.isJoinRequestPending || !isPaidGroupPolicy(policy) || !shouldShowPolicy(policy, false, currentUserLogin)) {
if (!policy?.isPolicyExpenseChatEnabled || policy?.isJoinRequestPending || !isGroupPolicy(policy) || !shouldShowPolicy(policy, false, currentUserLogin)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep the FAB selector beta-aware

This FAB-specific selector now includes every Submit workspace because isGroupPolicy() does not check SUBMIT_2026. In the FAB flow, a non-beta user with only a Submit workspace will have groupPoliciesWithChatEnabled.length > 0, so useCreateReport skips the upgrade path and can create a report in a workspace whose Submit features should still be gated; use the new beta-aware helper here as in the other create-report entry points.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No need since users won't be able to create the workspace if they are not in the beta

continue;
}

Expand Down
4 changes: 2 additions & 2 deletions src/pages/iou/request/step/IOURequestStepCategory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import getNonEmptyStringOnyxID from '@libs/getNonEmptyStringOnyxID';
import Navigation from '@libs/Navigation/Navigation';
import {hasEnabledOptions} from '@libs/OptionsListUtils';
import {hasAccountingConnections, isPolicyAdmin} from '@libs/PolicyUtils';
import {getTransactionDetails, isGroupPolicy, isReportInGroupPolicy, isSelfDM} from '@libs/ReportUtils';
import {getTransactionDetails, isReportInGroupPolicy, isSelfDM} from '@libs/ReportUtils';
import type {SkeletonSpanReasonAttributes} from '@libs/telemetry/useSkeletonSpan';
import {getRequestType} from '@libs/TransactionUtils';
import CONST from '@src/CONST';
Expand Down Expand Up @@ -116,7 +116,7 @@ function IOURequestStepCategory({
: undefined;

const shouldShowCategory =
(isReportInGroupPolicy(report) || isGroupPolicy(policy?.type ?? '')) &&
isReportInGroupPolicy(report, policy) &&
// The transactionCategory can be an empty string, so to maintain the logic we'd like to keep it in this shape until utils refactor

(!!categoryForDisplay || hasEnabledOptions(Object.values(policyCategories ?? {})));
Expand Down
13 changes: 1 addition & 12 deletions src/selectors/Policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ import escapeRegExp from 'lodash/escapeRegExp';
import type {OnyxCollection, OnyxEntry} from 'react-native-onyx';
import {hasSynchronizationErrorMessage, isConnectionUnverified} from '@libs/actions/connections';
import {getDisplayNameForWorkspace} from '@libs/actions/Policy/Policy';
import {getActiveAdminWorkspaces, getOwnedPaidPolicies, isPaidGroupPolicy, shouldShowPolicy} from '@libs/PolicyUtils';
import {getActiveAdminWorkspaces, getOwnedPaidPolicies, isPaidGroupPolicy} from '@libs/PolicyUtils';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {Policy, PolicyReportField} from '@src/types/onyx';
import {isEmptyObject} from '@src/types/utils/EmptyObject';

type ReusablePolicyConnectionName =
| typeof CONST.POLICY.CONNECTIONS.NAME.NETSUITE
Expand Down Expand Up @@ -88,15 +87,6 @@ const hasMultipleOutputCurrenciesSelector = (policies: OnyxCollection<Policy>) =
return false;
};

const groupPaidPoliciesWithExpenseChatEnabledSelector = (policies: OnyxCollection<Policy>, currentUserLogin: string | undefined) => {
if (isEmptyObject(policies)) {
return CONST.EMPTY_ARRAY;
}
return Object.values(policies ?? {}).filter(
(policy): policy is Policy => !!policy?.isPolicyExpenseChatEnabled && !policy?.isJoinRequestPending && isPaidGroupPolicy(policy) && shouldShowPolicy(policy, false, currentUserLogin),
);
};

type PolicySelector = Pick<Policy, 'type' | 'role' | 'isPolicyExpenseChatEnabled' | 'pendingAction' | 'avatarURL' | 'name' | 'id' | 'areInvoicesEnabled'>;

const policyMapper = (policy: OnyxEntry<Policy>): PolicySelector =>
Expand Down Expand Up @@ -261,7 +251,6 @@ export {
createPoliciesForDomainCardsSelector,
policyTimeTrackingSelector,
hasMultipleOutputCurrenciesSelector,
groupPaidPoliciesWithExpenseChatEnabledSelector,
iouRequestPolicyCollectionSelector,
policyMapper,
adminPoliciesConnectedToQBDSelector,
Expand Down
1 change: 1 addition & 0 deletions tests/actions/IOU/RequestMoneyTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ jest.mock('@src/libs/SearchQueryUtils', () => {
jest.mock('@libs/PolicyUtils', () => ({
...jest.requireActual<typeof PolicyUtils>('@libs/PolicyUtils'),
isPaidGroupPolicy: jest.fn().mockReturnValue(true),
isGroupPolicy: jest.fn().mockReturnValue(true),
isPolicyOwner: jest.fn().mockImplementation((policy?: OnyxEntry<Policy>, currentUserAccountID?: number) => !!currentUserAccountID && policy?.ownerAccountID === currentUserAccountID),
}));

Expand Down
1 change: 1 addition & 0 deletions tests/actions/ReportPreviewActionUtilsTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ jest.mock('@libs/PolicyUtils', () => ({
hasAccountingConnections: jest.fn().mockReturnValue(true),
getValidConnectedIntegration: jest.fn().mockReturnValue('netsuite'),
isPaidGroupPolicy: jest.fn().mockReturnValue(true),
isGroupPolicy: jest.fn().mockReturnValue(true),
}));
jest.mock('@src/libs/SearchUIUtils', () => ({
getSuggestedSearches: jest.fn().mockReturnValue({}),
Expand Down
1 change: 1 addition & 0 deletions tests/unit/ReportSecondaryActionUtilsTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jest.mock('@libs/PolicyUtils', () => ({
isPolicyAuditor: (...args: Parameters<typeof PolicyUtils.isPolicyAuditor>) => jest.requireActual<typeof PolicyUtils>('@libs/PolicyUtils').isPolicyAuditor(...args),
getValidConnectedIntegration: jest.fn().mockReturnValue('netsuite'),
isPaidGroupPolicy: jest.fn().mockReturnValue(true),
isGroupPolicy: jest.fn().mockReturnValue(true),
}));

describe('getSecondaryAction', () => {
Expand Down
Loading
Loading