Skip to content

Commit e6db42c

Browse files
committed
update tests
1 parent e6a7fc3 commit e6db42c

2 files changed

Lines changed: 0 additions & 194 deletions

File tree

tests/actions/IOU/PerDiemTest.ts

Lines changed: 0 additions & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -876,132 +876,4 @@ describe('PerDiem', () => {
876876
expect(perDiemTransactions.length).toBeGreaterThan(0);
877877
});
878878
});
879-
880-
describe('submitPerDiemExpense with conciergeReportID', () => {
881-
it('should accept conciergeReportID and submit per diem expense successfully', async () => {
882-
const iouReportID = '2';
883-
const policyID = 'B';
884-
885-
await Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${iouReportID}`, {
886-
reportID: iouReportID,
887-
policyID,
888-
type: CONST.REPORT.TYPE.EXPENSE,
889-
ownerAccountID: currentUserPersonalDetails.accountID,
890-
});
891-
892-
submitPerDiemExpense({
893-
currentUserAccountIDParam: currentUserPersonalDetails.accountID,
894-
currentUserEmailParam: currentUserPersonalDetails.login ?? '',
895-
hasViolations: false,
896-
isASAPSubmitBetaEnabled: false,
897-
participantParams: {
898-
payeeEmail: currentUserPersonalDetails.login,
899-
payeeAccountID: currentUserPersonalDetails.accountID,
900-
participant: {},
901-
},
902-
report: {
903-
reportID: '1',
904-
iouReportID,
905-
},
906-
transactionParams: {
907-
created: DateUtils.getDBTime(),
908-
currency: CONST.CURRENCY.USD,
909-
customUnit: {
910-
customUnitID: 'A',
911-
name: CONST.CUSTOM_UNITS.NAME_PER_DIEM_INTERNATIONAL,
912-
customUnitRateID: 'B',
913-
subRates: [{id: '1', name: 'rate_a', quantity: 1, rate: 2}],
914-
attributes: {dates: {end: '', start: ''}},
915-
},
916-
},
917-
policyRecentlyUsedCurrencies: [],
918-
policyParams: {
919-
policy: {...createRandomPolicy(1)},
920-
},
921-
quickAction: undefined,
922-
betas: [CONST.BETAS.ALL],
923-
personalDetails: {[RORY_ACCOUNT_ID]: {accountID: RORY_ACCOUNT_ID, login: RORY_EMAIL}},
924-
conciergeReportID: 'concierge789',
925-
});
926-
927-
await waitForBatchedUpdates();
928-
929-
const transactions = await new Promise<OnyxCollection<Transaction>>((resolve) => {
930-
const connection = Onyx.connect({
931-
key: ONYXKEYS.COLLECTION.TRANSACTION,
932-
waitForCollectionCallback: true,
933-
callback: (value) => {
934-
Onyx.disconnect(connection);
935-
resolve(value);
936-
},
937-
});
938-
});
939-
940-
const perDiemTransactions = Object.values(transactions ?? {}).filter((tx) => tx?.iouRequestType === CONST.IOU.REQUEST_TYPE.PER_DIEM);
941-
expect(perDiemTransactions.length).toBeGreaterThan(0);
942-
});
943-
944-
it('should work when conciergeReportID is undefined', async () => {
945-
const iouReportID = '2';
946-
const policyID = 'B';
947-
948-
await Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT}${iouReportID}`, {
949-
reportID: iouReportID,
950-
policyID,
951-
type: CONST.REPORT.TYPE.EXPENSE,
952-
ownerAccountID: currentUserPersonalDetails.accountID,
953-
});
954-
955-
submitPerDiemExpense({
956-
currentUserAccountIDParam: currentUserPersonalDetails.accountID,
957-
currentUserEmailParam: currentUserPersonalDetails.login ?? '',
958-
hasViolations: false,
959-
isASAPSubmitBetaEnabled: false,
960-
participantParams: {
961-
payeeEmail: currentUserPersonalDetails.login,
962-
payeeAccountID: currentUserPersonalDetails.accountID,
963-
participant: {},
964-
},
965-
report: {
966-
reportID: '1',
967-
iouReportID,
968-
},
969-
transactionParams: {
970-
created: DateUtils.getDBTime(),
971-
currency: CONST.CURRENCY.USD,
972-
customUnit: {
973-
customUnitID: 'A',
974-
name: CONST.CUSTOM_UNITS.NAME_PER_DIEM_INTERNATIONAL,
975-
customUnitRateID: 'B',
976-
subRates: [{id: '1', name: 'rate_a', quantity: 1, rate: 2}],
977-
attributes: {dates: {end: '', start: ''}},
978-
},
979-
},
980-
policyRecentlyUsedCurrencies: [],
981-
policyParams: {
982-
policy: {...createRandomPolicy(1)},
983-
},
984-
quickAction: undefined,
985-
betas: [CONST.BETAS.ALL],
986-
personalDetails: {[RORY_ACCOUNT_ID]: {accountID: RORY_ACCOUNT_ID, login: RORY_EMAIL}},
987-
conciergeReportID: undefined,
988-
});
989-
990-
await waitForBatchedUpdates();
991-
992-
const transactions = await new Promise<OnyxCollection<Transaction>>((resolve) => {
993-
const connection = Onyx.connect({
994-
key: ONYXKEYS.COLLECTION.TRANSACTION,
995-
waitForCollectionCallback: true,
996-
callback: (value) => {
997-
Onyx.disconnect(connection);
998-
resolve(value);
999-
},
1000-
});
1001-
});
1002-
1003-
const perDiemTransactions = Object.values(transactions ?? {}).filter((tx) => tx?.iouRequestType === CONST.IOU.REQUEST_TYPE.PER_DIEM);
1004-
expect(perDiemTransactions.length).toBeGreaterThan(0);
1005-
});
1006-
});
1007879
});

tests/actions/IOUTest/DuplicateTest.ts

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1808,61 +1808,6 @@ describe('actions/Duplicate', () => {
18081808
expect(duplicatedTransaction?.currency).toBe(mockTransaction.currency);
18091809
expect(Math.abs(duplicatedTransaction?.amount ?? 0)).toBe(Math.abs(mockTransaction.amount));
18101810
});
1811-
1812-
it('should accept conciergeReportID and pass it through to createExpenseByType', async () => {
1813-
const mockConciergeReportID = 'concierge123';
1814-
const {waypoints, ...restOfComment} = mockTransaction.comment ?? {};
1815-
const mockCashExpenseTransaction = {
1816-
...mockTransaction,
1817-
amount: mockTransaction.amount * -1,
1818-
comment: {
1819-
...restOfComment,
1820-
},
1821-
};
1822-
1823-
await Onyx.clear();
1824-
1825-
duplicateExpenseTransaction({
1826-
transaction: mockCashExpenseTransaction,
1827-
optimisticChatReportID: mockOptimisticChatReportID,
1828-
optimisticIOUReportID: mockOptimisticIOUReportID,
1829-
isASAPSubmitBetaEnabled: mockIsASAPSubmitBetaEnabled,
1830-
introSelected: undefined,
1831-
activePolicyID: undefined,
1832-
quickAction: undefined,
1833-
policyRecentlyUsedCurrencies: [],
1834-
isSelfTourViewed: false,
1835-
customUnitPolicyID: '',
1836-
targetPolicy: mockPolicy,
1837-
targetPolicyCategories: fakePolicyCategories,
1838-
targetReport: policyExpenseChat,
1839-
existingTransactionDraft: undefined,
1840-
draftTransactionIDs: [],
1841-
personalDetails: mockPersonalDetails,
1842-
betas: [CONST.BETAS.ALL],
1843-
recentWaypoints,
1844-
targetPolicyTags,
1845-
conciergeReportID: mockConciergeReportID,
1846-
currentUserAccountID: RORY_ACCOUNT_ID,
1847-
currentUserLogin: RORY_EMAIL,
1848-
});
1849-
1850-
await waitForBatchedUpdates();
1851-
1852-
// Verify the transaction was still created successfully with conciergeReportID
1853-
let duplicatedTransaction: OnyxEntry<Transaction>;
1854-
1855-
await getOnyxData({
1856-
key: ONYXKEYS.COLLECTION.TRANSACTION,
1857-
waitForCollectionCallback: true,
1858-
callback: (allTransactions) => {
1859-
duplicatedTransaction = Object.values(allTransactions ?? {}).find((t) => !!t);
1860-
},
1861-
});
1862-
1863-
expect(duplicatedTransaction).toBeDefined();
1864-
expect(duplicatedTransaction?.transactionID).not.toBe(mockCashExpenseTransaction.transactionID);
1865-
});
18661811
});
18671812

18681813
describe('resolveDuplicate', () => {
@@ -2465,17 +2410,6 @@ describe('actions/Duplicate', () => {
24652410
expect(call[1]).not.toEqual(expect.objectContaining({shouldPlaySound: true}));
24662411
}
24672412
});
2468-
2469-
it('should accept conciergeReportID and duplicate transactions successfully', async () => {
2470-
const tx1 = createCashTransaction('tx1');
2471-
const tx2 = createCashTransaction('tx2', {merchant: 'Coffee Shop'});
2472-
2473-
duplicateReport(getDefaultParams([tx1, tx2], {conciergeReportID: 'concierge456'}));
2474-
await waitForBatchedUpdates();
2475-
2476-
expect(countWriteCommandCalls(WRITE_COMMANDS.CREATE_APP_REPORT)).toBe(1);
2477-
expect(countWriteCommandCalls(WRITE_COMMANDS.REQUEST_MONEY)).toBe(2);
2478-
});
24792413
});
24802414

24812415
describe('bulkDuplicateExpenses', () => {

0 commit comments

Comments
 (0)