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
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ function useUpdateGpsNotificationOnUnitChange() {
const {translate} = useLocalize();

const [amountOwed] = useOnyx(ONYXKEYS.NVP_PRIVATE_AMOUNT_OWED);
const [ownerBillingGraceEndPeriod] = useOnyx(ONYXKEYS.NVP_PRIVATE_OWNER_BILLING_GRACE_PERIOD_END);
const [transaction] = useOnyx(`${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${CONST.IOU.OPTIMISTIC_TRANSACTION_ID}`);

const defaultExpensePolicy = useDefaultExpensePolicy();
const shouldUseDefaultExpensePolicy = shouldUseDefaultExpensePolicyUtil(CONST.IOU.TYPE.CREATE, defaultExpensePolicy, amountOwed);
const shouldUseDefaultExpensePolicy = shouldUseDefaultExpensePolicyUtil(CONST.IOU.TYPE.CREATE, defaultExpensePolicy, amountOwed, ownerBillingGraceEndPeriod);

const unit = DistanceRequestUtils.getRate({transaction, policy: shouldUseDefaultExpensePolicy ? defaultExpensePolicy : undefined}).unit;

Expand Down
8 changes: 6 additions & 2 deletions src/libs/actions/IOU/MoneyRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ type MoneyRequestStepScanParticipantsFlowParams = {
participants: Participant[];
participantsPolicyTags: Record<string, PolicyTagLists>;
amountOwed: OnyxEntry<number>;
ownerBillingGraceEndPeriod?: OnyxEntry<number>;
};

type MoneyRequestStepDistanceNavigationParams = {
Expand Down Expand Up @@ -173,6 +174,7 @@ type MoneyRequestStepDistanceNavigationParams = {
personalOutputCurrency?: string;
isSelfTourViewed: boolean;
amountOwed: OnyxEntry<number>;
ownerBillingGraceEndPeriod?: OnyxEntry<number>;
};

function createTransaction({
Expand Down Expand Up @@ -333,6 +335,7 @@ function handleMoneyRequestStepScanParticipants({
participants,
participantsPolicyTags,
amountOwed,
ownerBillingGraceEndPeriod,
}: MoneyRequestStepScanParticipantsFlowParams) {
if (backTo) {
Navigation.goBack(backTo);
Expand Down Expand Up @@ -510,7 +513,7 @@ function handleMoneyRequestStepScanParticipants({

// If there was no reportID, then that means the user started this flow from the global + menu
// and an optimistic reportID was generated. In that case, the next step is to select the participants for this expense.
if (shouldUseDefaultExpensePolicy(iouType, defaultExpensePolicy, amountOwed)) {
if (shouldUseDefaultExpensePolicy(iouType, defaultExpensePolicy, amountOwed, ownerBillingGraceEndPeriod)) {
const shouldAutoReport = !!defaultExpensePolicy?.autoReporting || isAutoReporting;
const targetReport = shouldAutoReport ? getPolicyExpenseChat(currentUserAccountID, defaultExpensePolicy?.id) : selfDMReport;
const transactionReportID = isSelfDM(targetReport) ? CONST.REPORT.UNREPORTED_REPORT_ID : targetReport?.reportID;
Expand Down Expand Up @@ -589,6 +592,7 @@ function handleMoneyRequestStepDistanceNavigation({
personalOutputCurrency,
isSelfTourViewed,
amountOwed,
ownerBillingGraceEndPeriod,
}: MoneyRequestStepDistanceNavigationParams) {
const isManualDistance = manualDistance !== undefined;
const isOdometerDistance = odometerDistance !== undefined;
Expand Down Expand Up @@ -738,7 +742,7 @@ function handleMoneyRequestStepDistanceNavigation({

// If there was no reportID, then that means the user started this flow from the global menu
// and an optimistic reportID was generated. In that case, the next step is to select the participants for this expense.
if (defaultExpensePolicy && shouldUseDefaultExpensePolicy(iouType, defaultExpensePolicy, amountOwed)) {
if (defaultExpensePolicy && shouldUseDefaultExpensePolicy(iouType, defaultExpensePolicy, amountOwed, ownerBillingGraceEndPeriod)) {
const shouldAutoReport = !!defaultExpensePolicy?.autoReporting || isAutoReporting;
const targetReport = shouldAutoReport ? getPolicyExpenseChat(currentUserAccountID, defaultExpensePolicy?.id) : selfDMReport;
const isSelfDMReport = isSelfDM(targetReport);
Expand Down
4 changes: 2 additions & 2 deletions src/libs/shouldUseDefaultExpensePolicy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import type {OnyxInputOrEntry, Policy} from '@src/types/onyx';
import {isPaidGroupPolicy} from './PolicyUtils';
import {shouldRestrictUserBillableActions} from './SubscriptionUtils';

function shouldUseDefaultExpensePolicy(iouType: IOUType, defaultExpensePolicy: OnyxInputOrEntry<Policy>, amountOwed: OnyxEntry<number>) {
function shouldUseDefaultExpensePolicy(iouType: IOUType, defaultExpensePolicy: OnyxInputOrEntry<Policy>, amountOwed: OnyxEntry<number>, ownerBillingGraceEndPeriod: OnyxEntry<number>) {
return (
iouType === CONST.IOU.TYPE.CREATE &&
isPaidGroupPolicy(defaultExpensePolicy) &&
defaultExpensePolicy?.isPolicyExpenseChatEnabled &&
!shouldRestrictUserBillableActions(defaultExpensePolicy.id, undefined, amountOwed)
!shouldRestrictUserBillableActions(defaultExpensePolicy.id, undefined, amountOwed, ownerBillingGraceEndPeriod)
);
}

Expand Down
3 changes: 2 additions & 1 deletion src/pages/iou/request/step/IOURequestStepAmount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ function IOURequestStepAmount({
const defaultExpensePolicy = useDefaultExpensePolicy();
const personalPolicy = usePersonalPolicy();
const [amountOwed] = useOnyx(ONYXKEYS.NVP_PRIVATE_AMOUNT_OWED);
const [ownerBillingGraceEndPeriod] = useOnyx(ONYXKEYS.NVP_PRIVATE_OWNER_BILLING_GRACE_PERIOD_END);
const isEditing = action === CONST.IOU.ACTION.EDIT;
const {duplicateTransactions, duplicateTransactionViolations} = useDuplicateTransactionsAndViolations(isEditing && transactionID ? [transactionID] : []);
const reportAttributesDerived = useReportAttributes();
Expand Down Expand Up @@ -326,7 +327,7 @@ function IOURequestStepAmount({

// Starting from global + menu means no participant context exists yet,
// so we need to handle participant selection based on available workspace settings
if (shouldUseDefaultExpensePolicy(iouType, defaultExpensePolicy, amountOwed)) {
if (shouldUseDefaultExpensePolicy(iouType, defaultExpensePolicy, amountOwed, ownerBillingGraceEndPeriod)) {
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;
Expand Down
3 changes: 3 additions & 0 deletions src/pages/iou/request/step/IOURequestStepDistance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ function IOURequestStepDistance({
const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST);
const defaultExpensePolicy = useDefaultExpensePolicy();
const [amountOwed] = useOnyx(ONYXKEYS.NVP_PRIVATE_AMOUNT_OWED);
const [ownerBillingGraceEndPeriod] = useOnyx(ONYXKEYS.NVP_PRIVATE_OWNER_BILLING_GRACE_PERIOD_END);
const [skipConfirmation] = useOnyx(`${ONYXKEYS.COLLECTION.SKIP_CONFIRMATION}${transactionID}`);
const [lastSelectedDistanceRates] = useOnyx(ONYXKEYS.NVP_LAST_SELECTED_DISTANCE_RATES);
const [quickAction] = useOnyx(ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE);
Expand Down Expand Up @@ -348,6 +349,7 @@ function IOURequestStepDistance({
draftTransactionIDs,
isSelfTourViewed: !!isSelfTourViewed,
amountOwed,
ownerBillingGraceEndPeriod,
});
}, [
iouType,
Expand Down Expand Up @@ -385,6 +387,7 @@ function IOURequestStepDistance({
draftTransactionIDs,
isSelfTourViewed,
amountOwed,
ownerBillingGraceEndPeriod,
]);

const getError = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ function IOURequestStepDistanceGPS({
const shouldShowNotFoundPage = useShowNotFoundPageInIOUStep(action, iouType, reportActionID, report, transaction);
const defaultExpensePolicy = useDefaultExpensePolicy();
const [amountOwed] = useOnyx(ONYXKEYS.NVP_PRIVATE_AMOUNT_OWED);
const [ownerBillingGraceEndPeriod] = useOnyx(ONYXKEYS.NVP_PRIVATE_OWNER_BILLING_GRACE_PERIOD_END);
const personalPolicy = usePersonalPolicy();
const policy = usePolicy(report?.policyID);
const isArchived = isArchivedReport(reportNameValuePairs);
Expand All @@ -77,7 +78,7 @@ function IOURequestStepDistanceGPS({
const currentUserAccountIDParam = currentUserPersonalDetails.accountID;
const currentUserEmailParam = currentUserPersonalDetails.login ?? '';

const shouldUseDefaultExpensePolicy = shouldUseDefaultExpensePolicyUtil(iouType, defaultExpensePolicy, amountOwed);
const shouldUseDefaultExpensePolicy = shouldUseDefaultExpensePolicyUtil(iouType, defaultExpensePolicy, amountOwed, ownerBillingGraceEndPeriod);

const customUnitRateID = getRateID(transaction);
const unit = DistanceRequestUtils.getRate({transaction, policy: shouldUseDefaultExpensePolicy ? defaultExpensePolicy : policy}).unit;
Expand Down Expand Up @@ -131,6 +132,7 @@ function IOURequestStepDistanceGPS({
draftTransactionIDs,
isSelfTourViewed: !!isSelfTourViewed,
amountOwed,
ownerBillingGraceEndPeriod,
});
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ function IOURequestStepDistanceManual({
const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST);
const defaultExpensePolicy = useDefaultExpensePolicy();
const [amountOwed] = useOnyx(ONYXKEYS.NVP_PRIVATE_AMOUNT_OWED);
const [ownerBillingGraceEndPeriod] = useOnyx(ONYXKEYS.NVP_PRIVATE_OWNER_BILLING_GRACE_PERIOD_END);
const {policyForMovingExpenses} = usePolicyForMovingExpenses();
const [skipConfirmation] = useOnyx(`${ONYXKEYS.COLLECTION.SKIP_CONFIRMATION}${transactionID}`);
const [lastSelectedDistanceRates] = useOnyx(ONYXKEYS.NVP_LAST_SELECTED_DISTANCE_RATES);
Expand All @@ -108,7 +109,10 @@ function IOURequestStepDistanceManual({
const currentUserAccountIDParam = currentUserPersonalDetails.accountID;
const currentUserEmailParam = currentUserPersonalDetails.login ?? '';

const shouldUseDefaultExpensePolicy = useMemo(() => shouldUseDefaultExpensePolicyUtil(iouType, defaultExpensePolicy, amountOwed), [iouType, defaultExpensePolicy, amountOwed]);
const shouldUseDefaultExpensePolicy = useMemo(
() => shouldUseDefaultExpensePolicyUtil(iouType, defaultExpensePolicy, amountOwed, ownerBillingGraceEndPeriod),
[iouType, defaultExpensePolicy, amountOwed, ownerBillingGraceEndPeriod],
);

const customUnitRateID = getRateID(transaction);
// to make sure the correct distance amount and unit will be shown we use distance unit
Expand Down Expand Up @@ -245,6 +249,7 @@ function IOURequestStepDistanceManual({
draftTransactionIDs,
isSelfTourViewed: !!isSelfTourViewed,
amountOwed,
ownerBillingGraceEndPeriod,
});
},
[
Expand Down Expand Up @@ -292,6 +297,7 @@ function IOURequestStepDistanceManual({
draftTransactionIDs,
isSelfTourViewed,
amountOwed,
ownerBillingGraceEndPeriod,
],
);

Expand Down
3 changes: 3 additions & 0 deletions src/pages/iou/request/step/IOURequestStepDistanceMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ function IOURequestStepDistanceMap({
const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST);
const defaultExpensePolicy = useDefaultExpensePolicy();
const [amountOwed] = useOnyx(ONYXKEYS.NVP_PRIVATE_AMOUNT_OWED);
const [ownerBillingGraceEndPeriod] = useOnyx(ONYXKEYS.NVP_PRIVATE_OWNER_BILLING_GRACE_PERIOD_END);
const [skipConfirmation] = useOnyx(`${ONYXKEYS.COLLECTION.SKIP_CONFIRMATION}${transactionID}`);
const [lastSelectedDistanceRates] = useOnyx(ONYXKEYS.NVP_LAST_SELECTED_DISTANCE_RATES);
const [quickAction] = useOnyx(ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE);
Expand Down Expand Up @@ -341,6 +342,7 @@ function IOURequestStepDistanceMap({
draftTransactionIDs,
isSelfTourViewed: !!isSelfTourViewed,
amountOwed,
ownerBillingGraceEndPeriod,
});
}, [
iouType,
Expand Down Expand Up @@ -378,6 +380,7 @@ function IOURequestStepDistanceMap({
draftTransactionIDs,
isSelfTourViewed,
amountOwed,
ownerBillingGraceEndPeriod,
]);

const getError = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ function IOURequestStepDistanceOdometer({
const personalPolicy = usePersonalPolicy();
const defaultExpensePolicy = useDefaultExpensePolicy();
const [amountOwed] = useOnyx(ONYXKEYS.NVP_PRIVATE_AMOUNT_OWED);
const [ownerBillingGraceEndPeriod] = useOnyx(ONYXKEYS.NVP_PRIVATE_OWNER_BILLING_GRACE_PERIOD_END);

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.

Please rename all of these to ownerBillingGracePeriodEnd

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.

@tgolen As mentioned in here:

I think it would be better to create a separate PR that focuses solely on the rename, since ownerBillingGraceEndPeriod is used throughout the app—not just in this PR.

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.

OK, sounds good. Thanks!

const selfDMReport = useSelfDMReport();
const {policyForMovingExpenses} = usePolicyForMovingExpenses();
const [isSelfTourViewed] = useOnyx(ONYXKEYS.NVP_ONBOARDING, {selector: hasSeenTourSelector});
Expand All @@ -136,7 +137,10 @@ function IOURequestStepDistanceOdometer({
const currentUserEmailParam = currentUserPersonalDetails.login ?? '';
const [shouldEnableDiscardConfirmation, setShouldEnableDiscardConfirmation] = useState(!isEditingConfirmation && !isEditing);

const shouldUseDefaultExpensePolicy = useMemo(() => shouldUseDefaultExpensePolicyUtil(iouType, defaultExpensePolicy, amountOwed), [iouType, defaultExpensePolicy, amountOwed]);
const shouldUseDefaultExpensePolicy = useMemo(
() => shouldUseDefaultExpensePolicyUtil(iouType, defaultExpensePolicy, amountOwed, ownerBillingGraceEndPeriod),
[iouType, defaultExpensePolicy, amountOwed, ownerBillingGraceEndPeriod],
);
const customUnitRateID = getRateID(transaction);

const mileageRate = DistanceRequestUtils.getRate({transaction: currentTransaction, policy: shouldUseDefaultExpensePolicy ? defaultExpensePolicy : policy});
Expand Down Expand Up @@ -500,6 +504,7 @@ function IOURequestStepDistanceOdometer({
draftTransactionIDs,
isSelfTourViewed: !!isSelfTourViewed,
amountOwed,
ownerBillingGraceEndPeriod,
});
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ function useReceiptScan({
const selfDMReport = useSelfDMReport();
const [allTransactionDrafts] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_DRAFT, {selector: validTransactionDraftsSelector});
const [amountOwed] = useOnyx(ONYXKEYS.NVP_PRIVATE_AMOUNT_OWED);
const [ownerBillingGraceEndPeriod] = useOnyx(ONYXKEYS.NVP_PRIVATE_OWNER_BILLING_GRACE_PERIOD_END);
const draftTransactionIDs = Object.keys(allTransactionDrafts ?? {});

const isEditing = action === CONST.IOU.ACTION.EDIT;
Expand Down Expand Up @@ -157,6 +158,7 @@ function useReceiptScan({
participants,
participantsPolicyTags,
amountOwed,
ownerBillingGraceEndPeriod,
});
}

Expand Down
63 changes: 54 additions & 9 deletions tests/actions/IOU/MoneyRequestTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,20 @@ describe('MoneyRequest', () => {
ROUTES.MONEY_REQUEST_STEP_PARTICIPANTS.getRoute(baseParams.iouType, baseParams.initialTransaction.transactionID, baseParams.reportID),
);
});

it('should pass ownerBillingGraceEndPeriod through to shouldUseDefaultExpensePolicy', () => {
const pastDate = Math.floor(Date.now() / 1000) - 86400 * 30;
handleMoneyRequestStepScanParticipants({
...baseParams,
defaultExpensePolicy: undefined,
amountOwed: 100,
ownerBillingGraceEndPeriod: pastDate,
});

expect(Navigation.navigate).toHaveBeenCalledWith(
ROUTES.MONEY_REQUEST_STEP_PARTICIPANTS.getRoute(baseParams.iouType, baseParams.initialTransaction.transactionID, baseParams.reportID),
);
});
});

describe('handleMoneyRequestStepDistanceNavigation', () => {
Expand Down Expand Up @@ -1302,6 +1316,20 @@ describe('MoneyRequest', () => {

expect(Navigation.navigate).toHaveBeenCalledWith(ROUTES.MONEY_REQUEST_STEP_PARTICIPANTS.getRoute(CONST.IOU.TYPE.CREATE, baseParams.transactionID, baseParams.reportID));
});

it('should pass ownerBillingGraceEndPeriod through to shouldUseDefaultExpensePolicy', () => {
const pastDate = Math.floor(Date.now() / 1000) - 86400 * 30;
handleMoneyRequestStepDistanceNavigation({
...baseParams,
report: undefined,
defaultExpensePolicy: undefined,
iouType: CONST.IOU.TYPE.CREATE,
amountOwed: 100,
ownerBillingGraceEndPeriod: pastDate,
});

expect(Navigation.navigate).toHaveBeenCalledWith(ROUTES.MONEY_REQUEST_STEP_PARTICIPANTS.getRoute(CONST.IOU.TYPE.CREATE, baseParams.transactionID, baseParams.reportID));
});
});

describe('shouldUseDefaultExpensePolicy', () => {
Expand All @@ -1314,7 +1342,7 @@ describe('MoneyRequest', () => {
isPolicyExpenseChatEnabled: true,
};

expect(shouldUseDefaultExpensePolicy(CONST.IOU.TYPE.CREATE, policy, 0)).toBe(true);
expect(shouldUseDefaultExpensePolicy(CONST.IOU.TYPE.CREATE, policy, 0, undefined)).toBe(true);
});

it('should return false when iouType is not CREATE', () => {
Expand All @@ -1324,9 +1352,9 @@ describe('MoneyRequest', () => {
isPolicyExpenseChatEnabled: true,
};

expect(shouldUseDefaultExpensePolicy(CONST.IOU.TYPE.SUBMIT, policy, 0)).toBe(false);
expect(shouldUseDefaultExpensePolicy(CONST.IOU.TYPE.TRACK, policy, 0)).toBe(false);
expect(shouldUseDefaultExpensePolicy(CONST.IOU.TYPE.SPLIT, policy, 0)).toBe(false);
expect(shouldUseDefaultExpensePolicy(CONST.IOU.TYPE.SUBMIT, policy, 0, undefined)).toBe(false);
expect(shouldUseDefaultExpensePolicy(CONST.IOU.TYPE.TRACK, policy, 0, undefined)).toBe(false);
expect(shouldUseDefaultExpensePolicy(CONST.IOU.TYPE.SPLIT, policy, 0, undefined)).toBe(false);
});

it('should return false when policy is not a paid group policy', () => {
Expand All @@ -1336,7 +1364,7 @@ describe('MoneyRequest', () => {
isPolicyExpenseChatEnabled: true,
};

expect(shouldUseDefaultExpensePolicy(CONST.IOU.TYPE.CREATE, policy, 0)).toBe(false);
expect(shouldUseDefaultExpensePolicy(CONST.IOU.TYPE.CREATE, policy, 0, undefined)).toBe(false);
});

it('should return false when isPolicyExpenseChatEnabled is false', () => {
Expand All @@ -1346,15 +1374,15 @@ describe('MoneyRequest', () => {
isPolicyExpenseChatEnabled: false,
};

expect(shouldUseDefaultExpensePolicy(CONST.IOU.TYPE.CREATE, policy, 0)).toBe(false);
expect(shouldUseDefaultExpensePolicy(CONST.IOU.TYPE.CREATE, policy, 0, undefined)).toBe(false);
});

it('should return false when policy is undefined', () => {
expect(shouldUseDefaultExpensePolicy(CONST.IOU.TYPE.CREATE, undefined, 0)).toBe(false);
expect(shouldUseDefaultExpensePolicy(CONST.IOU.TYPE.CREATE, undefined, 0, undefined)).toBe(false);
});

it('should return false when policy is null', () => {
expect(shouldUseDefaultExpensePolicy(CONST.IOU.TYPE.CREATE, null, 0)).toBe(false);
expect(shouldUseDefaultExpensePolicy(CONST.IOU.TYPE.CREATE, null, 0, undefined)).toBe(false);
});

it('should handle amountOwed being undefined', () => {
Expand All @@ -1364,7 +1392,24 @@ describe('MoneyRequest', () => {
isPolicyExpenseChatEnabled: true,
};

expect(shouldUseDefaultExpensePolicy(CONST.IOU.TYPE.CREATE, policy, undefined)).toBe(true);
expect(shouldUseDefaultExpensePolicy(CONST.IOU.TYPE.CREATE, policy, undefined, undefined)).toBe(true);
});

it('should pass ownerBillingGraceEndPeriod through to shouldRestrictUserBillableActions', async () => {
const policy = {
...fakePolicy,
type: CONST.POLICY.TYPE.TEAM,
isPolicyExpenseChatEnabled: true,
ownerAccountID: TEST_USER_ACCOUNT_ID,
};
const pastDate = Math.floor(Date.now() / 1000) - 86400 * 30;

await Onyx.set(ONYXKEYS.SESSION, {accountID: TEST_USER_ACCOUNT_ID});
await Onyx.set(`${ONYXKEYS.COLLECTION.POLICY}${policy.id}`, policy);

expect(shouldUseDefaultExpensePolicy(CONST.IOU.TYPE.CREATE, policy, 100, pastDate)).toBe(false);

await Onyx.clear();
});
});
});
Loading