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
1 change: 0 additions & 1 deletion __mocks__/reportData/policies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ const policy420A: Policy = {
outputCurrency: 'USD',
avatarURL: '',
employeeList: {},
isPolicyExpenseChatEnabled: true,
lastModified: '1744880511066991',
chatReportIDAnnounce: '0',
chatReportIDAdmins: '1552825053855260',
Expand Down
3 changes: 0 additions & 3 deletions src/types/onyx/Policy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2880,9 +2880,6 @@ type Policy = OnyxCommon.OnyxValueWithOfflineFeedback<
/** The custom units data for this policy */
customUnits?: Record<string, CustomUnit>;

/** Deprecated legacy flag for policy expense chat compatibility. */
isPolicyExpenseChatEnabled?: boolean;

/** Whether the auto reporting is enabled */
autoReporting?: boolean;

Expand Down
16 changes: 2 additions & 14 deletions tests/actions/IOU/MoneyRequestTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1255,11 +1255,6 @@ describe('MoneyRequest', () => {
it('should navigate to confirmation page for CREATE flow from global menu', async () => {
await Onyx.set(`${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, fakePolicy);

const defaultExpensePolicy = {
...fakePolicy,
isPolicyExpenseChatEnabled: true,
};

// getPolicyExpenseChat resolves reports via ReportUtils' internal Onyx cache, which isn't populated
// in this bare unit-test harness, so return the policy expense chat report directly.
jest.mocked(getPolicyExpenseChat).mockReturnValueOnce(fakeReport);
Expand All @@ -1268,7 +1263,7 @@ describe('MoneyRequest', () => {
getCurrencyDecimals: getCurrencyDecimalsLocal,
...baseParams,
report: undefined,
defaultExpensePolicy,
defaultExpensePolicy: fakePolicy,
isAutoReporting: true,
iouType: CONST.IOU.TYPE.CREATE,
draftTransactionIDs: [baseParams.transactionID],
Expand Down Expand Up @@ -1306,7 +1301,6 @@ describe('MoneyRequest', () => {
const defaultExpensePolicy = {
...fakePolicy,
autoReporting: false,
isPolicyExpenseChatEnabled: true,
};

handleMoneyRequestStepDistanceNavigation({
Expand Down Expand Up @@ -1799,11 +1793,10 @@ describe('MoneyRequest', () => {
describe('shouldUseDefaultExpensePolicy', () => {
const fakePolicy = createRandomPolicy(1, CONST.POLICY.TYPE.TEAM);

it('should return true when iouType is CREATE with a paid group policy that has expense chat enabled and no billing restrictions', () => {
it('should return true when iouType is CREATE with a paid group policy and no billing restrictions', () => {
const policy = {
...fakePolicy,
type: CONST.POLICY.TYPE.TEAM,
isPolicyExpenseChatEnabled: true,
};

expect(shouldUseDefaultExpensePolicy(CONST.IOU.TYPE.CREATE, policy, 0, undefined, undefined, currentUserAccountID)).toBe(true);
Expand All @@ -1813,7 +1806,6 @@ describe('MoneyRequest', () => {
const policy = {
...fakePolicy,
type: CONST.POLICY.TYPE.TEAM,
isPolicyExpenseChatEnabled: true,
};

expect(shouldUseDefaultExpensePolicy(CONST.IOU.TYPE.SUBMIT, policy, 0, undefined, undefined, currentUserAccountID)).toBe(false);
Expand All @@ -1825,7 +1817,6 @@ describe('MoneyRequest', () => {
const policy = {
...fakePolicy,
type: CONST.POLICY.TYPE.PERSONAL,
isPolicyExpenseChatEnabled: true,
};

expect(shouldUseDefaultExpensePolicy(CONST.IOU.TYPE.CREATE, policy, 0, undefined, undefined, currentUserAccountID)).toBe(false);
Expand All @@ -1835,7 +1826,6 @@ describe('MoneyRequest', () => {
const policy = {
...fakePolicy,
type: CONST.POLICY.TYPE.PERSONAL,
isPolicyExpenseChatEnabled: false,
};

expect(shouldUseDefaultExpensePolicy(CONST.IOU.TYPE.CREATE, policy, 0, undefined, undefined, currentUserAccountID)).toBe(false);
Expand All @@ -1853,7 +1843,6 @@ describe('MoneyRequest', () => {
const policy = {
...fakePolicy,
type: CONST.POLICY.TYPE.TEAM,
isPolicyExpenseChatEnabled: true,
};

expect(shouldUseDefaultExpensePolicy(CONST.IOU.TYPE.CREATE, policy, undefined, undefined, undefined, currentUserAccountID)).toBe(true);
Expand All @@ -1863,7 +1852,6 @@ describe('MoneyRequest', () => {
const policy = {
...fakePolicy,
type: CONST.POLICY.TYPE.TEAM,
isPolicyExpenseChatEnabled: true,
ownerAccountID: TEST_USER_ACCOUNT_ID,
};
const pastDate = Math.floor(Date.now() / 1000) - 86400 * 30;
Expand Down
1 change: 0 additions & 1 deletion tests/actions/IOU/RequestMoneyTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1229,7 +1229,6 @@ describe('actions/IOU', () => {
type: CONST.POLICY.TYPE.TEAM,
owner: RORY_EMAIL,
outputCurrency: CONST.CURRENCY.USD,
isPolicyExpenseChatEnabled: true,
employeeList: {
[CARLOS_EMAIL]: {
role: CONST.POLICY.ROLE.ADMIN,
Expand Down
5 changes: 0 additions & 5 deletions tests/actions/IOU/SplitExpenseItemsTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ describe('initSplitExpenseItemData stale tax handling', () => {
type: CONST.POLICY.TYPE.TEAM,
owner: 'owner@test.com',
outputCurrency: CONST.CURRENCY.USD,
isPolicyExpenseChatEnabled: true,
role: CONST.POLICY.ROLE.ADMIN,
tax: {trackingEnabled: true},
taxRates: {
Expand All @@ -45,7 +44,6 @@ describe('initSplitExpenseItemData stale tax handling', () => {
type: CONST.POLICY.TYPE.TEAM,
owner: 'owner@test.com',
outputCurrency: CONST.CURRENCY.USD,
isPolicyExpenseChatEnabled: true,
role: CONST.POLICY.ROLE.ADMIN,
tax: {trackingEnabled: true},
taxRates: {
Expand All @@ -68,7 +66,6 @@ describe('initSplitExpenseItemData stale tax handling', () => {
type: CONST.POLICY.TYPE.TEAM,
owner: 'owner@test.com',
outputCurrency: CONST.CURRENCY.USD,
isPolicyExpenseChatEnabled: true,
role: CONST.POLICY.ROLE.ADMIN,
tax: {trackingEnabled: true},
taxRates: {
Expand All @@ -91,7 +88,6 @@ describe('initSplitExpenseItemData stale tax handling', () => {
type: CONST.POLICY.TYPE.TEAM,
owner: 'owner@test.com',
outputCurrency: CONST.CURRENCY.USD,
isPolicyExpenseChatEnabled: true,
role: CONST.POLICY.ROLE.ADMIN,
tax: {trackingEnabled: true},
taxRates: {
Expand All @@ -113,7 +109,6 @@ describe('initSplitExpenseItemData stale tax handling', () => {
type: CONST.POLICY.TYPE.TEAM,
owner: 'owner@test.com',
outputCurrency: CONST.CURRENCY.USD,
isPolicyExpenseChatEnabled: true,
role: CONST.POLICY.ROLE.ADMIN,
tax: {trackingEnabled: true},
taxRates: {
Expand Down
1 change: 0 additions & 1 deletion tests/actions/IOUTest/DeleteMoneyRequestTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,6 @@ describe('actions/IOU/DeleteMoneyRequest', () => {
name: '',
owner: '',
outputCurrency: '',
isPolicyExpenseChatEnabled: false,
},
policyTagList: {},
policyCategories: {},
Expand Down
3 changes: 0 additions & 3 deletions tests/actions/IOUTest/PayMoneyRequestTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,6 @@ describe('actions/IOU/PayMoneyRequest', () => {
role: CONST.POLICY.ROLE.ADMIN,
owner: adminEmail,
outputCurrency: CONST.CURRENCY.USD,
isPolicyExpenseChatEnabled: true,
type: CONST.POLICY.TYPE.CORPORATE,
approvalMode: CONST.POLICY.APPROVAL_MODE.OPTIONAL,
employeeList: {
Expand Down Expand Up @@ -1748,7 +1747,6 @@ describe('actions/IOU/PayMoneyRequest', () => {
owner: adminEmail,
ownerAccountID: adminAccountID,
outputCurrency: CONST.CURRENCY.USD,
isPolicyExpenseChatEnabled: true,
type: CONST.POLICY.TYPE.CORPORATE,
approvalMode: CONST.POLICY.APPROVAL_MODE.OPTIONAL,
reimbursementChoice: CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_YES,
Expand Down Expand Up @@ -1822,7 +1820,6 @@ describe('actions/IOU/PayMoneyRequest', () => {
owner: adminEmail,
ownerAccountID: adminAccountID,
outputCurrency: CONST.CURRENCY.USD,
isPolicyExpenseChatEnabled: true,
type: CONST.POLICY.TYPE.CORPORATE,
approvalMode: CONST.POLICY.APPROVAL_MODE.OPTIONAL,
reimbursementChoice: CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_YES,
Expand Down
7 changes: 0 additions & 7 deletions tests/actions/IOUTest/ReportWorkflowTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,6 @@ describe('actions/IOU/ReportWorkflow', () => {
role: CONST.POLICY.ROLE.ADMIN,
owner: CARLOS_EMAIL,
outputCurrency: CONST.CURRENCY.USD,
isPolicyExpenseChatEnabled: true,
approvalMode: CONST.POLICY.APPROVAL_MODE.BASIC,
};

Expand Down Expand Up @@ -452,7 +451,6 @@ describe('actions/IOU/ReportWorkflow', () => {
role: CONST.POLICY.ROLE.ADMIN,
owner: CARLOS_EMAIL,
outputCurrency: CONST.CURRENCY.USD,
isPolicyExpenseChatEnabled: true,
approvalMode: CONST.POLICY.APPROVAL_MODE.DYNAMICEXTERNAL,
};

Expand Down Expand Up @@ -567,7 +565,6 @@ describe('actions/IOU/ReportWorkflow', () => {
role: CONST.POLICY.ROLE.ADMIN,
owner: CARLOS_EMAIL,
outputCurrency: CONST.CURRENCY.USD,
isPolicyExpenseChatEnabled: true,
approvalMode: CONST.POLICY.APPROVAL_MODE.BASIC,
};

Expand Down Expand Up @@ -669,7 +666,6 @@ describe('actions/IOU/ReportWorkflow', () => {
role: CONST.POLICY.ROLE.ADMIN,
owner: CARLOS_EMAIL,
outputCurrency: CONST.CURRENCY.USD,
isPolicyExpenseChatEnabled: true,
approvalMode: CONST.POLICY.APPROVAL_MODE.OPTIONAL,
};

Expand Down Expand Up @@ -3970,7 +3966,6 @@ describe('actions/IOU/ReportWorkflow', () => {
owner: adminEmail,
ownerAccountID: adminAccountID,
outputCurrency: CONST.CURRENCY.USD,
isPolicyExpenseChatEnabled: true,
type: CONST.POLICY.TYPE.CORPORATE,
approvalMode: CONST.POLICY.APPROVAL_MODE.ADVANCED,
reimbursementChoice: CONST.POLICY.REIMBURSEMENT_CHOICES.REIMBURSEMENT_MANUAL,
Expand Down Expand Up @@ -4215,7 +4210,6 @@ describe('actions/IOU/ReportWorkflow', () => {
role: CONST.POLICY.ROLE.ADMIN,
owner: adminEmail,
outputCurrency: CONST.CURRENCY.USD,
isPolicyExpenseChatEnabled: true,
type: CONST.POLICY.TYPE.CORPORATE,
approvalMode: CONST.POLICY.APPROVAL_MODE.ADVANCED,
employeeList: {
Expand Down Expand Up @@ -4528,7 +4522,6 @@ describe('actions/IOU/ReportWorkflow', () => {
role: CONST.POLICY.ROLE.ADMIN,
owner: adminEmail,
outputCurrency: CONST.CURRENCY.USD,
isPolicyExpenseChatEnabled: true,
type: CONST.POLICY.TYPE.CORPORATE,
approvalMode: CONST.POLICY.APPROVAL_MODE.ADVANCED,
employeeList: {
Expand Down
2 changes: 0 additions & 2 deletions tests/actions/IOUTest/UpdateMoneyRequestTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,6 @@ describe('actions/IOU/UpdateMoneyRequest', () => {
name: '',
owner: '',
outputCurrency: '',
isPolicyExpenseChatEnabled: false,
},
policyTagList: {},
policyCategories: {},
Expand Down Expand Up @@ -519,7 +518,6 @@ describe('actions/IOU/UpdateMoneyRequest', () => {
name: '',
owner: '',
outputCurrency: '',
isPolicyExpenseChatEnabled: false,
},
policyTagList: {},
policyCategories: {},
Expand Down
1 change: 0 additions & 1 deletion tests/actions/ReportPreviewActionUtilsTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,6 @@ describe('getReportPreviewAction', () => {
owner: OWNER_EMAIL,
ownerAccountID: OWNER_ACCOUNT_ID,
outputCurrency: 'USD',
isPolicyExpenseChatEnabled: true,
approvalMode: CONST.POLICY.APPROVAL_MODE.ADVANCED,
approver: OWNER_EMAIL,
preventSelfApproval: false,
Expand Down
8 changes: 0 additions & 8 deletions tests/actions/ReportTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2780,7 +2780,6 @@ describe('actions/Report', () => {
// Given a policy with harvesting is disabled
const policy = {
...createRandomPolicy(Number(policyID)),
isPolicyExpenseChatEnabled: true,
type: CONST.POLICY.TYPE.TEAM,
autoReporting: false,
autoReportingFrequency: CONST.POLICY.AUTO_REPORTING_FREQUENCIES.IMMEDIATE,
Expand Down Expand Up @@ -2869,7 +2868,6 @@ describe('actions/Report', () => {
global.fetch = mockFetchData;
const policy = {
...createRandomPolicy(Number(policyID)),
isPolicyExpenseChatEnabled: true,
type: CONST.POLICY.TYPE.TEAM,
harvesting: {
enabled: false,
Expand Down Expand Up @@ -2902,7 +2900,6 @@ describe('actions/Report', () => {
// Given a policy with harvesting is enabled
const policy = {
...createRandomPolicy(Number(policyID)),
isPolicyExpenseChatEnabled: true,
type: CONST.POLICY.TYPE.TEAM,
autoReportingFrequency: CONST.POLICY.AUTO_REPORTING_FREQUENCIES.IMMEDIATE,
harvesting: {
Expand Down Expand Up @@ -2939,7 +2936,6 @@ describe('actions/Report', () => {
// Given a policy with instant submission and approval disabled
const policy: OnyxTypes.Policy = {
...createRandomPolicy(Number(policyID)),
isPolicyExpenseChatEnabled: true,
type: CONST.POLICY.TYPE.TEAM,
autoReportingFrequency: CONST.POLICY.AUTO_REPORTING_FREQUENCIES.INSTANT,
approvalMode: CONST.POLICY.APPROVAL_MODE.OPTIONAL,
Expand Down Expand Up @@ -2983,7 +2979,6 @@ describe('actions/Report', () => {

const policy = {
...createRandomPolicy(Number(policyID)),
isPolicyExpenseChatEnabled: true,
type: CONST.POLICY.TYPE.TEAM,
autoReporting: false,
autoReportingFrequency: CONST.POLICY.AUTO_REPORTING_FREQUENCIES.IMMEDIATE,
Expand Down Expand Up @@ -4117,7 +4112,6 @@ describe('actions/Report', () => {
role: CONST.POLICY.ROLE.ADMIN,
type: CONST.POLICY.TYPE.TEAM,
outputCurrency: CONST.CURRENCY.USD,
isPolicyExpenseChatEnabled: true,
employeeList: {
[adminEmail]: {
role: CONST.POLICY.ROLE.ADMIN,
Expand Down Expand Up @@ -4362,7 +4356,6 @@ describe('actions/Report', () => {
id: 'targetPolicy',
role: CONST.POLICY.ROLE.ADMIN,
type: CONST.POLICY.TYPE.TEAM,
isPolicyExpenseChatEnabled: true,
employeeList: {
[existingAdminEmail]: {email: existingAdminEmail, role: CONST.POLICY.ROLE.ADMIN},
[existingUserEmail]: {email: existingUserEmail, role: CONST.POLICY.ROLE.USER},
Expand Down Expand Up @@ -4654,7 +4647,6 @@ describe('actions/Report', () => {
role: CONST.POLICY.ROLE.ADMIN,
type: CONST.POLICY.TYPE.TEAM,
outputCurrency: CONST.CURRENCY.USD,
isPolicyExpenseChatEnabled: true,
employeeList: {
'admin@test.com': {
role: CONST.POLICY.ROLE.ADMIN,
Expand Down
1 change: 0 additions & 1 deletion tests/data/Invoice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const policy: OnyxEntry<OnyxTypes.Policy> = {
role: 'admin',
owner: 'a1@53019.com',
ownerAccountID: 32,
isPolicyExpenseChatEnabled: true,
outputCurrency: 'USD',
autoReporting: true,
autoReportingFrequency: 'instant',
Expand Down
1 change: 0 additions & 1 deletion tests/perf-test/OptionsListUtils.perf-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ const allPolicies = {
type: CONST.POLICY.TYPE.TEAM,
owner: 'test@expensify.com',
outputCurrency: 'USD',
isPolicyExpenseChatEnabled: false,
approvalMode: CONST.POLICY.APPROVAL_MODE.OPTIONAL,
} as Policy,
};
Expand Down
1 change: 0 additions & 1 deletion tests/ui/AgentsPromoBannersTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ function buildPolicy(): Policy {
owner: USER_EMAIL,
outputCurrency: 'USD',
approvalMode: CONST.POLICY.APPROVAL_MODE.BASIC,
isPolicyExpenseChatEnabled: true,
areWorkflowsEnabled: true,
areRulesEnabled: true,
pendingAction: null,
Expand Down
2 changes: 0 additions & 2 deletions tests/ui/DistanceRequestStartPageTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,6 @@ describe('DistanceRequestStartPage', () => {
type: CONST.POLICY.TYPE.TEAM,
name: 'Workspace',
role: CONST.POLICY.ROLE.USER,
isPolicyExpenseChatEnabled: true,
autoReporting: true,
commuterExclusions: {
method: CONST.POLICY.COMMUTER_EXCLUSION_METHOD.FIXED_DISTANCE,
Expand Down Expand Up @@ -342,7 +341,6 @@ describe('DistanceRequestStartPage', () => {
type: CONST.POLICY.TYPE.TEAM,
name: policyID,
role: CONST.POLICY.ROLE.USER,
isPolicyExpenseChatEnabled: true,
autoReporting: false,
commuterExclusions: {
method: CONST.POLICY.COMMUTER_EXCLUSION_METHOD.FIXED_DISTANCE,
Expand Down
1 change: 0 additions & 1 deletion tests/ui/IOURequestStepDistanceRateTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ function buildPolicy(rateCount: number): Policy {
type: CONST.POLICY.TYPE.CORPORATE,
owner: ACCOUNT_LOGIN,
outputCurrency: CONST.CURRENCY.USD,
isPolicyExpenseChatEnabled: true,
customUnits: {
[CUSTOM_UNIT_ID]: {
attributes: {unit: CONST.CUSTOM_UNITS.DISTANCE_UNIT_MILES},
Expand Down
1 change: 0 additions & 1 deletion tests/ui/ImportedMembersPageTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ function buildSubmitPolicy(): Policy {
[ADMIN_EMAIL]: {email: ADMIN_EMAIL, role: CONST.POLICY.ROLE.ADMIN},
},
outputCurrency: 'USD',
isPolicyExpenseChatEnabled: true,
pendingAction: null,
errors: {},
} as Policy;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ const mockPolicy: Policy = {
role: CONST.POLICY.ROLE.ADMIN,
},
},
isPolicyExpenseChatEnabled: true,
} as Policy;

const mockTransaction: Transaction = {
Expand Down
Loading
Loading