From 531e306b4d52fee58c5db62982d33c948408422d Mon Sep 17 00:00:00 2001 From: Daniel Edwards Date: Mon, 4 Dec 2023 15:52:30 -0500 Subject: [PATCH 1/8] Added optimistic logic for transaction threads --- src/libs/actions/IOU.js | 87 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 83 insertions(+), 4 deletions(-) diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index c0466f8c2604..dfc3940c4acf 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -154,6 +154,8 @@ function buildOnyxDataForMoneyRequest( optimisticPolicyRecentlyUsedTags, isNewChatReport, isNewIOUReport, + transactionThreadReportID, + threadCreatedAction, ) { const optimisticData = [ { @@ -200,6 +202,13 @@ function buildOnyxDataForMoneyRequest( [iouAction.reportActionID]: iouAction, }, }, + { + onyxMethod: Onyx.METHOD.SET, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${transactionThreadReportID}`, + value: { + [threadCreatedAction.reportActionID]: threadCreatedAction, + }, + }, ]; if (!_.isEmpty(optimisticPolicyRecentlyUsedCategories)) { @@ -401,6 +410,8 @@ function buildOnyxDataForMoneyRequest( * @param {String} [category] * @param {String} [tag] * @param {Boolean} [billable] + * @param {Number} [transactionThreadReportID] + * @param {Number} [createdReportActionForThread] * @returns {Object} data * @returns {String} data.payerEmail * @returns {Object} data.iouReport @@ -562,6 +573,9 @@ function getMoneyRequestInformation( currentTime, ); + const transactionThread = ReportUtils.buildTransactionThread(iouAction, iouReport.reportID); + const optimisticCreatedActionForThread = ReportUtils.buildOptimisticCreatedReportAction(CONST.REPORT.OWNER_ACCOUNT_ID_FAKE); + let reportPreviewAction = isNewIOUReport ? null : ReportActionsUtils.getReportPreviewAction(chatReport.reportID, iouReport.reportID); if (reportPreviewAction) { reportPreviewAction = ReportUtils.updateReportPreview(iouReport, reportPreviewAction, false, comment, optimisticTransaction); @@ -601,6 +615,8 @@ function getMoneyRequestInformation( optimisticPolicyRecentlyUsedTags, isNewChatReport, isNewIOUReport, + transactionThread.reportID, + optimisticCreatedActionForThread, ); return { @@ -618,6 +634,8 @@ function getMoneyRequestInformation( successData, failureData, }, + transactionThreadReportID: Number(transactionThread.reportID), + createdReportActionForThread: optimisticCreatedActionForThread, }; } @@ -645,7 +663,18 @@ function createDistanceRequest(report, participant, comment, created, transactio source: ReceiptGeneric, state: CONST.IOU.RECEIPT_STATE.OPEN, }; - const {iouReport, chatReport, transaction, iouAction, createdChatReportActionID, createdIOUReportActionID, reportPreviewAction, onyxData} = getMoneyRequestInformation( + const { + iouReport, + chatReport, + transaction, + iouAction, + createdChatReportActionID, + createdIOUReportActionID, + reportPreviewAction, + onyxData, + transactionThreadReportID, + createdReportActionForThread, + } = getMoneyRequestInformation( currentChatReport, participant, comment, @@ -677,6 +706,8 @@ function createDistanceRequest(report, participant, comment, created, transactio category, tag, billable, + transactionThreadReportID: Number(transactionThreadReportID), + createdReportActionForThread: Number(createdReportActionForThread), }, onyxData, ); @@ -867,8 +898,20 @@ function requestMoney( // If the report is iou or expense report, we should get the linked chat report to be passed to the getMoneyRequestInformation function const isMoneyRequestReport = ReportUtils.isMoneyRequestReport(report); const currentChatReport = isMoneyRequestReport ? ReportUtils.getReport(report.chatReportID) : report; - const {payerAccountID, payerEmail, iouReport, chatReport, transaction, iouAction, createdChatReportActionID, createdIOUReportActionID, reportPreviewAction, onyxData} = - getMoneyRequestInformation(currentChatReport, participant, comment, amount, currency, created, merchant, payeeAccountID, payeeEmail, receipt, undefined, category, tag, billable); + const { + payerAccountID, + payerEmail, + iouReport, + chatReport, + transaction, + iouAction, + createdChatReportActionID, + createdIOUReportActionID, + reportPreviewAction, + onyxData, + transactionThreadReportID, + createdReportActionForThread, + } = getMoneyRequestInformation(currentChatReport, participant, comment, amount, currency, created, merchant, payeeAccountID, payeeEmail, receipt, undefined, category, tag, billable); const activeReportID = isMoneyRequestReport ? report.reportID : chatReport.reportID; API.write( @@ -893,6 +936,8 @@ function requestMoney( category, tag, billable, + transactionThreadReportID, + createdReportActionForThread, }, onyxData, ); @@ -1702,6 +1747,9 @@ function completeSplitBill(chatReportID, reportAction, updatedTransaction, sessi oneOnOneReportPreviewAction = ReportUtils.buildOptimisticReportPreview(oneOnOneChatReport, oneOnOneIOUReport, '', oneOnOneTransaction); } + const transactionThread = ReportUtils.buildTransactionThread(oneOnOneIOUReport, oneOnOneIOUReport.reportID); + const optimisticCreatedActionForThread = ReportUtils.buildOptimisticCreatedReportAction(CONST.REPORT.OWNER_ACCOUNT_ID_FAKE); + const [oneOnOneOptimisticData, oneOnOneSuccessData, oneOnOneFailureData] = buildOnyxDataForMoneyRequest( oneOnOneChatReport, oneOnOneIOUReport, @@ -1715,6 +1763,8 @@ function completeSplitBill(chatReportID, reportAction, updatedTransaction, sessi {}, isNewOneOnOneChatReport, shouldCreateNewOneOnOneIOUReport, + transactionThread.reportID, + optimisticCreatedActionForThread, ); splits.push({ @@ -1728,6 +1778,8 @@ function completeSplitBill(chatReportID, reportAction, updatedTransaction, sessi createdChatReportActionID: oneOnOneCreatedActionForChat.reportActionID, createdIOUReportActionID: oneOnOneCreatedActionForIOU.reportActionID, reportPreviewReportActionID: oneOnOneReportPreviewAction.reportActionID, + transactionThreadReportID: transactionThread.reportID, + createdReportActionIDForThread: optimisticCreatedActionForThread.reportActionID, }); optimisticData.push(...oneOnOneOptimisticData); @@ -2285,6 +2337,9 @@ function getSendMoneyParams(report, amount, currency, comment, paymentMethodType const reportPreviewAction = ReportUtils.buildOptimisticReportPreview(chatReport, optimisticIOUReport); + const transactionThread = ReportUtils.buildTransactionThread(optimisticIOUReportAction, optimisticIOUReport.reportID); + const optimisticCreatedActionForThread = ReportUtils.buildOptimisticCreatedReportAction(CONST.REPORT.OWNER_ACCOUNT_ID_FAKE); + // First, add data that will be used in all cases const optimisticChatReportData = { onyxMethod: Onyx.METHOD.MERGE, @@ -2322,6 +2377,14 @@ function getSendMoneyParams(report, amount, currency, comment, paymentMethodType }, }; + const optimisticTransactionThreadReportActionsData = { + onyxMethod: Onyx.METHOD.SET, + key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionThread.reportID}`, + value: { + [optimisticCreatedActionForThread.reportActionID]: optimisticCreatedActionForThread, + }, + }; + const successData = [ { onyxMethod: Onyx.METHOD.MERGE, @@ -2346,6 +2409,15 @@ function getSendMoneyParams(report, amount, currency, comment, paymentMethodType }, }, }, + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${transactionThread.reportID}`, + value: { + [optimisticCreatedActionForThread.reportActionID]: { + pendingAction: null, + }, + }, + }, ]; const failureData = [ @@ -2423,7 +2495,14 @@ function getSendMoneyParams(report, amount, currency, comment, paymentMethodType }); } - const optimisticData = [optimisticChatReportData, optimisticIOUReportData, optimisticChatReportActionsData, optimisticIOUReportActionsData, optimisticTransactionData]; + const optimisticData = [ + optimisticChatReportData, + optimisticIOUReportData, + optimisticChatReportActionsData, + optimisticIOUReportActionsData, + optimisticTransactionData, + optimisticTransactionThreadReportActionsData, + ]; if (!_.isEmpty(optimisticPersonalDetailListData)) { optimisticData.push(optimisticPersonalDetailListData); } From 6405744297ba7e2a92a292ec27e0662d02548c10 Mon Sep 17 00:00:00 2001 From: Daniel Edwards Date: Mon, 4 Dec 2023 20:24:44 -0500 Subject: [PATCH 2/8] Undo unnecessary number conversion --- src/libs/actions/IOU.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index 3db9c296d86b..86043063b540 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -666,8 +666,8 @@ function createDistanceRequest(report, participant, comment, created, transactio category, tag, billable, - transactionThreadReportID: Number(transactionThreadReportID), - createdReportActionForThread: Number(createdReportActionForThread), + transactionThreadReportID, + createdReportActionForThread, }, onyxData, ); From b2e6e2e0d1ef5bc01f856ca5e89866325e77b1aa Mon Sep 17 00:00:00 2001 From: Daniel Edwards Date: Fri, 8 Dec 2023 11:33:20 -0500 Subject: [PATCH 3/8] Trying to figure out these tests --- src/libs/actions/IOU.js | 39 +++++++++++++++++++++++++++++++-------- tests/actions/IOUTest.js | 30 ++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 8 deletions(-) diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index 43b5735fa415..06eedc4b7182 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -126,8 +126,7 @@ function buildOnyxDataForMoneyRequest( optimisticPolicyRecentlyUsedTags, isNewChatReport, isNewIOUReport, - transactionThreadReportID, - threadCreatedAction, + transactionThreadReportAction, ) { const optimisticData = [ { @@ -176,9 +175,9 @@ function buildOnyxDataForMoneyRequest( }, { onyxMethod: Onyx.METHOD.SET, - key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${transactionThreadReportID}`, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReport.reportID}`, value: { - [threadCreatedAction.reportActionID]: threadCreatedAction, + [transactionThreadReportAction.reportActionID]: transactionThreadReportAction, }, }, ]; @@ -275,6 +274,16 @@ function buildOnyxDataForMoneyRequest( }, }, }, + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReport.reportID}`, + value: { + [transactionThreadReportAction.reportActionID]: { + pendingAction: null, + errors: null, + }, + }, + }, ]; const failureData = [ @@ -359,6 +368,15 @@ function buildOnyxDataForMoneyRequest( }), }, }, + { + onyxMethod: Onyx.METHOD.MERGE, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReport.reportID}`, + value: { + [transactionThreadReportAction.reportActionID]: { + errors: ErrorUtils.getMicroSecondOnyxError('iou.error.genericCreateFailureMessage'), + }, + }, + }, ]; return [optimisticData, successData, failureData]; @@ -534,7 +552,7 @@ function getMoneyRequestInformation( ); const transactionThread = ReportUtils.buildTransactionThread(iouAction, iouReport.reportID); - const optimisticCreatedActionForThread = ReportUtils.buildOptimisticCreatedReportAction(CONST.REPORT.OWNER_ACCOUNT_ID_FAKE); + const optimisticCreatedActionForThread = ReportUtils.buildOptimisticCreatedReportAction(payeeEmail); let reportPreviewAction = isNewIOUReport ? null : ReportActionsUtils.getReportPreviewAction(chatReport.reportID, iouReport.reportID); if (reportPreviewAction) { @@ -575,7 +593,6 @@ function getMoneyRequestInformation( optimisticPolicyRecentlyUsedTags, isNewChatReport, isNewIOUReport, - transactionThread.reportID, optimisticCreatedActionForThread, ); @@ -1199,6 +1216,10 @@ function createSplitsAndOnyxData(participants, currentUserLogin, currentUserAcco // Add tag to optimistic policy recently used tags when a participant is a workspace const optimisticPolicyRecentlyUsedTags = isPolicyExpenseChat ? Policy.buildOptimisticPolicyRecentlyUsedTags(participant.policyID, tag) : {}; + // Add transaction thread to optimistic data + const transactionThread = ReportUtils.buildTransactionThread(oneOnOneIOUReport, oneOnOneIOUReport.reportID); + const optimisticCreatedActionForThread = ReportUtils.buildOptimisticCreatedReportAction(currentUserEmailForIOUSplit); + // STEP 5: Build Onyx Data const [oneOnOneOptimisticData, oneOnOneSuccessData, oneOnOneFailureData] = buildOnyxDataForMoneyRequest( oneOnOneChatReport, @@ -1213,6 +1234,8 @@ function createSplitsAndOnyxData(participants, currentUserLogin, currentUserAcco optimisticPolicyRecentlyUsedTags, isNewOneOnOneChatReport, shouldCreateNewOneOnOneIOUReport, + transactionThread.reportID, + optimisticCreatedActionForThread, ); const individualSplit = { @@ -1726,7 +1749,7 @@ function completeSplitBill(chatReportID, reportAction, updatedTransaction, sessi } const transactionThread = ReportUtils.buildTransactionThread(oneOnOneIOUReport, oneOnOneIOUReport.reportID); - const optimisticCreatedActionForThread = ReportUtils.buildOptimisticCreatedReportAction(CONST.REPORT.OWNER_ACCOUNT_ID_FAKE); + const optimisticCreatedActionForThread = ReportUtils.buildOptimisticCreatedReportAction(currentUserEmailForIOUSplit); const [oneOnOneOptimisticData, oneOnOneSuccessData, oneOnOneFailureData] = buildOnyxDataForMoneyRequest( oneOnOneChatReport, @@ -2307,7 +2330,7 @@ function getSendMoneyParams(report, amount, currency, comment, paymentMethodType const reportPreviewAction = ReportUtils.buildOptimisticReportPreview(chatReport, optimisticIOUReport); const transactionThread = ReportUtils.buildTransactionThread(optimisticIOUReportAction, optimisticIOUReport.reportID); - const optimisticCreatedActionForThread = ReportUtils.buildOptimisticCreatedReportAction(CONST.REPORT.OWNER_ACCOUNT_ID_FAKE); + const optimisticCreatedActionForThread = ReportUtils.buildOptimisticCreatedReportAction(recipientEmail); // First, add data that will be used in all cases const optimisticChatReportData = { diff --git a/tests/actions/IOUTest.js b/tests/actions/IOUTest.js index 18793e88d624..ad5758102890 100644 --- a/tests/actions/IOUTest.js +++ b/tests/actions/IOUTest.js @@ -1,3 +1,4 @@ +import {tr} from 'date-fns/locale'; import Onyx from 'react-native-onyx'; import _ from 'underscore'; import CONST from '../../src/CONST'; @@ -553,6 +554,8 @@ describe('actions/IOU', () => { let createdAction; let iouAction; let transactionID; + let transactionThreadReportID; + let transactionThreadAction; fetch.pause(); IOU.requestMoney({}, amount, CONST.CURRENCY.USD, '', '', RORY_EMAIL, RORY_ACCOUNT_ID, {login: CARLOS_EMAIL, accountID: CARLOS_ACCOUNT_ID}, comment); return ( @@ -565,6 +568,7 @@ describe('actions/IOU', () => { waitForCollectionCallback: true, callback: (allReports) => { Onyx.disconnect(connectionID); + console.log('ALL REPORTS : ', allReports); // A chat report and an iou report should be created const chatReports = _.filter(allReports, (report) => report.type === CONST.REPORT.TYPE.CHAT); @@ -596,11 +600,14 @@ describe('actions/IOU', () => { waitForCollectionCallback: true, callback: (reportActionsForIOUReport) => { Onyx.disconnect(connectionID); + console.log('REPORT ACTIONS FOR IOU REPORT : ', reportActionsForIOUReport); // The chat report should have a CREATED action and IOU action expect(_.size(reportActionsForIOUReport)).toBe(2); const createdActions = _.filter(reportActionsForIOUReport, (reportAction) => reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.CREATED); const iouActions = _.filter(reportActionsForIOUReport, (reportAction) => reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.IOU); + console.log('CREATED ACTIONS : ', createdActions); + console.log('IOU ACTIONS : ', iouActions); expect(_.size(createdActions)).toBe(1); expect(_.size(iouActions)).toBe(1); createdAction = createdActions[0]; @@ -638,6 +645,7 @@ describe('actions/IOU', () => { waitForCollectionCallback: true, callback: (allTransactions) => { Onyx.disconnect(connectionID); + console.log('ALL TRANSACTIONS : ', allTransactions); // There should be one transaction expect(_.size(allTransactions)).toBe(1); @@ -670,6 +678,7 @@ describe('actions/IOU', () => { waitForCollectionCallback: true, callback: (reportActionsForIOUReport) => { Onyx.disconnect(connectionID); + console.log('REPORT ACTIONS FOR IOU REPORT : ', reportActionsForIOUReport); expect(_.size(reportActionsForIOUReport)).toBe(2); iouAction = _.find(reportActionsForIOUReport, (reportAction) => reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.IOU); expect(iouAction.pendingAction).toBe(CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD); @@ -678,6 +687,23 @@ describe('actions/IOU', () => { }); }), ) + .then( + () => + new Promise((resolve) => { + const connectionID = Onyx.connect({ + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}`, + waitForCollectionCallback: true, + callback: (reportActionsForTransactionThread) => { + Onyx.disconnect(connectionID); + console.log('REPORT ACTIONS FOR TRANSACTION THREAD : ', iouReportID, reportActionsForTransactionThread); + expect(_.size(reportActionsForTransactionThread)).toBe(1); + transactionThreadAction = _.filter(reportActionsForTransactionThread, (reportAction) => reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.IOU); + expect(transactionThreadAction.pendingAction).toBe(CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD); + resolve(); + }, + }); + }), + ) .then( () => new Promise((resolve) => { @@ -686,6 +712,7 @@ describe('actions/IOU', () => { waitForCollectionCallback: true, callback: (transaction) => { Onyx.disconnect(connectionID); + console.log('TRANSACTION : ', transaction); expect(transaction.pendingAction).toBeFalsy(); expect(transaction.errors).toBeTruthy(); expect(_.values(transaction.errors)[0]).toBe('iou.error.genericCreateFailureMessage'); @@ -700,6 +727,7 @@ describe('actions/IOU', () => { () => new Promise((resolve) => { ReportActions.clearReportActionErrors(iouReportID, iouAction); + ReportActions.clearReportActionErrors(transactionThreadReportID, transactionThreadAction); resolve(); }), ) @@ -771,6 +799,7 @@ describe('actions/IOU', () => { waitForCollectionCallback: true, callback: (allReportActions) => { Onyx.disconnect(connectionID); + console.log('ALL REPORT ACTIONS : ', allReportActions); _.each(allReportActions, (reportAction) => expect(reportAction).toBeFalsy()); resolve(); }, @@ -1012,6 +1041,7 @@ describe('actions/IOU', () => { waitForCollectionCallback: true, callback: (allReportActions) => { Onyx.disconnect(connectionID); + console.log("HERE'S ALL THE REPORT ACTIONS: ", allReportActions); // There should be reportActions on all 4 chat reports + 3 IOU reports in each 1:1 chat expect(_.size(allReportActions)).toBe(7); From 923e1bfef4be9730493fd3df4aae05fc311f71ef Mon Sep 17 00:00:00 2001 From: Daniel Edwards Date: Mon, 11 Dec 2023 16:02:24 -0500 Subject: [PATCH 4/8] Making progress on this issue, still need to fix tests --- src/libs/actions/IOU.js | 24 +++++++++----- tests/actions/IOUTest.js | 69 ++++++++++++++++++++++++++++++---------- 2 files changed, 69 insertions(+), 24 deletions(-) diff --git a/src/libs/actions/IOU.js b/src/libs/actions/IOU.js index 06eedc4b7182..aa0c70f67674 100644 --- a/src/libs/actions/IOU.js +++ b/src/libs/actions/IOU.js @@ -126,7 +126,8 @@ function buildOnyxDataForMoneyRequest( optimisticPolicyRecentlyUsedTags, isNewChatReport, isNewIOUReport, - transactionThreadReportAction, + transactionThreadReport, + transactionThreadCreatedReportAction, ) { const optimisticData = [ { @@ -175,9 +176,14 @@ function buildOnyxDataForMoneyRequest( }, { onyxMethod: Onyx.METHOD.SET, - key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReport.reportID}`, + key: `${ONYXKEYS.COLLECTION.REPORT}${transactionThreadReport.reportID}`, + value: transactionThreadReport, + }, + { + onyxMethod: Onyx.METHOD.SET, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${transactionThreadReport.reportID}`, value: { - [transactionThreadReportAction.reportActionID]: transactionThreadReportAction, + [transactionThreadCreatedReportAction.reportActionID]: transactionThreadCreatedReportAction, }, }, ]; @@ -276,9 +282,9 @@ function buildOnyxDataForMoneyRequest( }, { onyxMethod: Onyx.METHOD.MERGE, - key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReport.reportID}`, + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${transactionThreadReport.reportID}`, value: { - [transactionThreadReportAction.reportActionID]: { + [transactionThreadCreatedReportAction.reportActionID]: { pendingAction: null, errors: null, }, @@ -372,7 +378,7 @@ function buildOnyxDataForMoneyRequest( onyxMethod: Onyx.METHOD.MERGE, key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReport.reportID}`, value: { - [transactionThreadReportAction.reportActionID]: { + [transactionThreadCreatedReportAction.reportActionID]: { errors: ErrorUtils.getMicroSecondOnyxError('iou.error.genericCreateFailureMessage'), }, }, @@ -593,6 +599,7 @@ function getMoneyRequestInformation( optimisticPolicyRecentlyUsedTags, isNewChatReport, isNewIOUReport, + transactionThread, optimisticCreatedActionForThread, ); @@ -612,7 +619,7 @@ function getMoneyRequestInformation( failureData, }, transactionThreadReportID: Number(transactionThread.reportID), - createdReportActionForThread: optimisticCreatedActionForThread, + createdReportActionForThread: Number(optimisticCreatedActionForThread.reportActionID), }; } @@ -1234,7 +1241,7 @@ function createSplitsAndOnyxData(participants, currentUserLogin, currentUserAcco optimisticPolicyRecentlyUsedTags, isNewOneOnOneChatReport, shouldCreateNewOneOnOneIOUReport, - transactionThread.reportID, + transactionThread, optimisticCreatedActionForThread, ); @@ -1765,6 +1772,7 @@ function completeSplitBill(chatReportID, reportAction, updatedTransaction, sessi isNewOneOnOneChatReport, shouldCreateNewOneOnOneIOUReport, transactionThread.reportID, + transactionThread, optimisticCreatedActionForThread, ); diff --git a/tests/actions/IOUTest.js b/tests/actions/IOUTest.js index ad5758102890..9db7b70af11c 100644 --- a/tests/actions/IOUTest.js +++ b/tests/actions/IOUTest.js @@ -58,6 +58,8 @@ describe('actions/IOU', () => { let createdAction; let iouAction; let transactionID; + let transactionThreadID; + let transactionThreadCreatedAction; fetch.pause(); IOU.requestMoney({}, amount, CONST.CURRENCY.USD, '', merchant, RORY_EMAIL, RORY_ACCOUNT_ID, {login: CARLOS_EMAIL, accountID: CARLOS_ACCOUNT_ID}, comment); return waitForBatchedUpdates() @@ -69,15 +71,18 @@ describe('actions/IOU', () => { waitForCollectionCallback: true, callback: (allReports) => { Onyx.disconnect(connectionID); + console.log('ALL REPORTS : ', allReports); - // A chat report and an iou report should be created + // A chat report, an iou report, and a transaction thread chat report should be created const chatReports = _.filter(allReports, (report) => report.type === CONST.REPORT.TYPE.CHAT); const iouReports = _.filter(allReports, (report) => report.type === CONST.REPORT.TYPE.IOU); - expect(_.size(chatReports)).toBe(1); + expect(_.size(chatReports)).toBe(2); expect(_.size(iouReports)).toBe(1); const chatReport = chatReports[0]; + const transactionThreadReport = chatReports[1]; const iouReport = iouReports[0]; iouReportID = iouReport.reportID; + transactionThreadID = transactionThreadReport.reportID; expect(iouReport.notificationPreference).toBe(CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN); @@ -133,6 +138,27 @@ describe('actions/IOU', () => { }); }), ) + .then( + () => + new Promise((resolve) => { + const connectionID = Onyx.connect({ + key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${transactionThreadID}`, + waitForCollectionCallback: true, + callback: (reportActionsForTransactionThread) => { + Onyx.disconnect(connectionID); + + // The transaction thread should have a CREATED action + expect(_.size(reportActionsForTransactionThread)).toBe(1); + const createdActions = _.filter(reportActionsForTransactionThread, (reportAction) => reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.CREATED); + expect(_.size(createdActions)).toBe(1); + transactionThreadCreatedAction = createdActions[0]; + + expect(transactionThreadCreatedAction.pendingAction).toBe(CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD); + resolve(); + }, + }); + }), + ) .then( () => new Promise((resolve) => { @@ -238,13 +264,14 @@ describe('actions/IOU', () => { waitForCollectionCallback: true, callback: (allReports) => { Onyx.disconnect(connectionID); - // The same chat report should be reused, and an IOU report should be created expect(_.size(allReports)).toBe(2); + console.log('AFTER THE FIRST CHECK'); expect(_.find(allReports, (report) => report.type === CONST.REPORT.TYPE.CHAT).reportID).toBe(chatReport.reportID); chatReport = _.find(allReports, (report) => report.type === CONST.REPORT.TYPE.CHAT); const iouReport = _.find(allReports, (report) => report.type === CONST.REPORT.TYPE.IOU); iouReportID = iouReport.reportID; + console.log('AFTER THE FIRST CHECKS'); expect(iouReport.notificationPreference).toBe(CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN); @@ -252,6 +279,7 @@ describe('actions/IOU', () => { expect(chatReport.iouReportID).toBe(iouReportID); expect(chatReport.hasOutstandingIOU).toBe(true); + console.log('END OF ALL REPORTS SUITE 2'); resolve(); }, }); @@ -265,6 +293,7 @@ describe('actions/IOU', () => { waitForCollectionCallback: true, callback: (allIOUReportActions) => { Onyx.disconnect(connectionID); + console.log('IOU REPORT ACTIONAS', allIOUReportActions); // The chat report should have a CREATED and an IOU action expect(_.size(allIOUReportActions)).toBe(2); @@ -289,6 +318,7 @@ describe('actions/IOU', () => { // The IOU action should be pending expect(iouAction.pendingAction).toBe(CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD); + console.log('END OF IOU REPORT ACTIONS SUITE 2'); resolve(); }, }); @@ -303,6 +333,7 @@ describe('actions/IOU', () => { callback: (allTransactions) => { Onyx.disconnect(connectionID); + console.log('ALL TRANSACTIONS SUITE 2', allTransactions); // There should be one transaction expect(_.size(allTransactions)).toBe(1); const transaction = _.find(allTransactions, (t) => !_.isEmpty(t)); @@ -325,6 +356,7 @@ describe('actions/IOU', () => { // The transactionID on the iou action should match the one from the transactions collection expect(iouAction.originalMessage.IOUTransactionID).toBe(transactionID); + console.log('END OF TRANSACTIONS SUITE 2'); resolve(); }, }); @@ -340,8 +372,10 @@ describe('actions/IOU', () => { waitForCollectionCallback: true, callback: (reportActionsForIOUReport) => { Onyx.disconnect(connectionID); + console.log('REPORT ACTIONS FOR IOU REPORT SUITE 2', reportActionsForIOUReport); expect(_.size(reportActionsForIOUReport)).toBe(2); _.each(reportActionsForIOUReport, (reportAction) => expect(reportAction.pendingAction).toBeFalsy()); + console.log('END OF REPORT ACTIONS FOR IOU REPORT SUITE 2'); resolve(); }, }); @@ -355,13 +389,15 @@ describe('actions/IOU', () => { waitForCollectionCallback: true, callback: (transaction) => { Onyx.disconnect(connectionID); + console.log('TRANSACTION SUITE 2', transaction); expect(transaction.pendingAction).toBeFalsy(); + console.log('END OF TRANSACTION SUITE 2'); resolve(); }, }); }), ); - }); + }, 10000); it('updates existing IOU report if there is one', () => { const amount = 10000; @@ -423,6 +459,7 @@ describe('actions/IOU', () => { .then(() => Onyx.set(`${ONYXKEYS.COLLECTION.TRANSACTION}${existingTransaction.transactionID}`, existingTransaction)) .then(() => { IOU.requestMoney(chatReport, amount, CONST.CURRENCY.USD, '', '', RORY_EMAIL, RORY_ACCOUNT_ID, {login: CARLOS_EMAIL, accountID: CARLOS_ACCOUNT_ID}, comment); + console.log('AFTER THE REQUEST MONEY IN THE THIRD TEST SUITE'); return waitForBatchedUpdates(); }) .then( @@ -544,7 +581,7 @@ describe('actions/IOU', () => { }); }), ); - }); + }, 10000); it('correctly implements RedBrickRoad error handling', () => { const amount = 10000; @@ -826,7 +863,7 @@ describe('actions/IOU', () => { // Cleanup .then(fetch.succeed) ); - }); + }, 10000); }); describe('split bill', () => { @@ -1234,7 +1271,7 @@ describe('actions/IOU', () => { }); }), ); - }); + }, 10000); }); describe('payMoneyRequestElsewhere', () => { @@ -1430,7 +1467,7 @@ describe('actions/IOU', () => { }); }), ); - }); + }, 10000); }); describe('edit money request', () => { @@ -1706,7 +1743,7 @@ describe('actions/IOU', () => { }); }), ); - }); + }, 10000); }); describe('pay expense report via ACH', () => { @@ -1827,7 +1864,7 @@ describe('actions/IOU', () => { }); }), ); - }); + }, 10000); it('shows an error when paying results in an error', () => { let expenseReport = {}; @@ -1893,7 +1930,7 @@ describe('actions/IOU', () => { }); }), ); - }); + }, 10000); }); describe('deleteMoneyRequest', () => { @@ -1947,8 +1984,8 @@ describe('actions/IOU', () => { }); }); - // Then we should have exactly 2 reports - expect(_.size(allReports)).toBe(2); + // Then we should have exactly 3 reports (chat, IOU and Transaction Thread) + expect(_.size(allReports)).toBe(3); // Then one of them should be a chat report with relevant properties chatReport = _.find(allReports, (report) => report.type === CONST.REPORT.TYPE.CHAT); @@ -2552,7 +2589,7 @@ describe('actions/IOU', () => { expect(iouReport).toHaveProperty('chatReportID'); expect(iouReport.hasOutstandingIOU).toBeTruthy(); expect(iouReport.total).toBe(20000); - }); + }, 10000); it('navigate the user correctly to the iou Report when appropriate', async () => { await waitForBatchedUpdates(); @@ -2773,7 +2810,7 @@ describe('actions/IOU', () => { }); }), ); - }); + }, 10000); it('correctly implements error handling', () => { const amount = 10000; const comment = '💸💸💸💸'; @@ -2873,6 +2910,6 @@ describe('actions/IOU', () => { }); }), ); - }); + }, 10000); }); }); From a81697d2ca3dc2319870b992280a05c29d399aae Mon Sep 17 00:00:00 2001 From: Daniel Edwards Date: Wed, 13 Dec 2023 10:53:31 -0500 Subject: [PATCH 5/8] Got the tests working --- tests/actions/IOUTest.js | 59 ++++++++++++++-------------------------- 1 file changed, 21 insertions(+), 38 deletions(-) diff --git a/tests/actions/IOUTest.js b/tests/actions/IOUTest.js index 9db7b70af11c..fec8a38f1c6f 100644 --- a/tests/actions/IOUTest.js +++ b/tests/actions/IOUTest.js @@ -50,6 +50,7 @@ describe('actions/IOU', () => { }); describe('requestMoney', () => { + jest.setTimeout(30000); it('creates new chat if needed', () => { const amount = 10000; const comment = 'Giv money plz'; @@ -71,7 +72,6 @@ describe('actions/IOU', () => { waitForCollectionCallback: true, callback: (allReports) => { Onyx.disconnect(connectionID); - console.log('ALL REPORTS : ', allReports); // A chat report, an iou report, and a transaction thread chat report should be created const chatReports = _.filter(allReports, (report) => report.type === CONST.REPORT.TYPE.CHAT); @@ -265,13 +265,11 @@ describe('actions/IOU', () => { callback: (allReports) => { Onyx.disconnect(connectionID); // The same chat report should be reused, and an IOU report should be created - expect(_.size(allReports)).toBe(2); - console.log('AFTER THE FIRST CHECK'); + expect(_.size(allReports)).toBe(3); expect(_.find(allReports, (report) => report.type === CONST.REPORT.TYPE.CHAT).reportID).toBe(chatReport.reportID); chatReport = _.find(allReports, (report) => report.type === CONST.REPORT.TYPE.CHAT); const iouReport = _.find(allReports, (report) => report.type === CONST.REPORT.TYPE.IOU); iouReportID = iouReport.reportID; - console.log('AFTER THE FIRST CHECKS'); expect(iouReport.notificationPreference).toBe(CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN); @@ -279,7 +277,6 @@ describe('actions/IOU', () => { expect(chatReport.iouReportID).toBe(iouReportID); expect(chatReport.hasOutstandingIOU).toBe(true); - console.log('END OF ALL REPORTS SUITE 2'); resolve(); }, }); @@ -293,7 +290,6 @@ describe('actions/IOU', () => { waitForCollectionCallback: true, callback: (allIOUReportActions) => { Onyx.disconnect(connectionID); - console.log('IOU REPORT ACTIONAS', allIOUReportActions); // The chat report should have a CREATED and an IOU action expect(_.size(allIOUReportActions)).toBe(2); @@ -318,7 +314,6 @@ describe('actions/IOU', () => { // The IOU action should be pending expect(iouAction.pendingAction).toBe(CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD); - console.log('END OF IOU REPORT ACTIONS SUITE 2'); resolve(); }, }); @@ -333,7 +328,6 @@ describe('actions/IOU', () => { callback: (allTransactions) => { Onyx.disconnect(connectionID); - console.log('ALL TRANSACTIONS SUITE 2', allTransactions); // There should be one transaction expect(_.size(allTransactions)).toBe(1); const transaction = _.find(allTransactions, (t) => !_.isEmpty(t)); @@ -356,7 +350,6 @@ describe('actions/IOU', () => { // The transactionID on the iou action should match the one from the transactions collection expect(iouAction.originalMessage.IOUTransactionID).toBe(transactionID); - console.log('END OF TRANSACTIONS SUITE 2'); resolve(); }, }); @@ -372,10 +365,8 @@ describe('actions/IOU', () => { waitForCollectionCallback: true, callback: (reportActionsForIOUReport) => { Onyx.disconnect(connectionID); - console.log('REPORT ACTIONS FOR IOU REPORT SUITE 2', reportActionsForIOUReport); expect(_.size(reportActionsForIOUReport)).toBe(2); _.each(reportActionsForIOUReport, (reportAction) => expect(reportAction.pendingAction).toBeFalsy()); - console.log('END OF REPORT ACTIONS FOR IOU REPORT SUITE 2'); resolve(); }, }); @@ -389,9 +380,7 @@ describe('actions/IOU', () => { waitForCollectionCallback: true, callback: (transaction) => { Onyx.disconnect(connectionID); - console.log('TRANSACTION SUITE 2', transaction); expect(transaction.pendingAction).toBeFalsy(); - console.log('END OF TRANSACTION SUITE 2'); resolve(); }, }); @@ -459,7 +448,6 @@ describe('actions/IOU', () => { .then(() => Onyx.set(`${ONYXKEYS.COLLECTION.TRANSACTION}${existingTransaction.transactionID}`, existingTransaction)) .then(() => { IOU.requestMoney(chatReport, amount, CONST.CURRENCY.USD, '', '', RORY_EMAIL, RORY_ACCOUNT_ID, {login: CARLOS_EMAIL, accountID: CARLOS_ACCOUNT_ID}, comment); - console.log('AFTER THE REQUEST MONEY IN THE THIRD TEST SUITE'); return waitForBatchedUpdates(); }) .then( @@ -472,7 +460,7 @@ describe('actions/IOU', () => { Onyx.disconnect(connectionID); // No new reports should be created - expect(_.size(allReports)).toBe(2); + expect(_.size(allReports)).toBe(3); expect(_.find(allReports, (report) => report.reportID === chatReportID)).toBeTruthy(); expect(_.find(allReports, (report) => report.reportID === iouReportID)).toBeTruthy(); @@ -605,17 +593,17 @@ describe('actions/IOU', () => { waitForCollectionCallback: true, callback: (allReports) => { Onyx.disconnect(connectionID); - console.log('ALL REPORTS : ', allReports); // A chat report and an iou report should be created const chatReports = _.filter(allReports, (report) => report.type === CONST.REPORT.TYPE.CHAT); const iouReports = _.filter(allReports, (report) => report.type === CONST.REPORT.TYPE.IOU); - expect(_.size(chatReports)).toBe(1); + expect(_.size(chatReports)).toBe(2); expect(_.size(iouReports)).toBe(1); const chatReport = chatReports[0]; chatReportID = chatReport.reportID; const iouReport = iouReports[0]; iouReportID = iouReport.reportID; + transactionThreadReportID = chatReports[1].reportID; expect(iouReport.notificationPreference).toBe(CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN); @@ -637,14 +625,11 @@ describe('actions/IOU', () => { waitForCollectionCallback: true, callback: (reportActionsForIOUReport) => { Onyx.disconnect(connectionID); - console.log('REPORT ACTIONS FOR IOU REPORT : ', reportActionsForIOUReport); // The chat report should have a CREATED action and IOU action expect(_.size(reportActionsForIOUReport)).toBe(2); const createdActions = _.filter(reportActionsForIOUReport, (reportAction) => reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.CREATED); const iouActions = _.filter(reportActionsForIOUReport, (reportAction) => reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.IOU); - console.log('CREATED ACTIONS : ', createdActions); - console.log('IOU ACTIONS : ', iouActions); expect(_.size(createdActions)).toBe(1); expect(_.size(iouActions)).toBe(1); createdAction = createdActions[0]; @@ -682,7 +667,6 @@ describe('actions/IOU', () => { waitForCollectionCallback: true, callback: (allTransactions) => { Onyx.disconnect(connectionID); - console.log('ALL TRANSACTIONS : ', allTransactions); // There should be one transaction expect(_.size(allTransactions)).toBe(1); @@ -715,8 +699,7 @@ describe('actions/IOU', () => { waitForCollectionCallback: true, callback: (reportActionsForIOUReport) => { Onyx.disconnect(connectionID); - console.log('REPORT ACTIONS FOR IOU REPORT : ', reportActionsForIOUReport); - expect(_.size(reportActionsForIOUReport)).toBe(2); + expect(_.size(reportActionsForIOUReport)).toBe(3); iouAction = _.find(reportActionsForIOUReport, (reportAction) => reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.IOU); expect(iouAction.pendingAction).toBe(CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD); resolve(); @@ -732,9 +715,11 @@ describe('actions/IOU', () => { waitForCollectionCallback: true, callback: (reportActionsForTransactionThread) => { Onyx.disconnect(connectionID); - console.log('REPORT ACTIONS FOR TRANSACTION THREAD : ', iouReportID, reportActionsForTransactionThread); - expect(_.size(reportActionsForTransactionThread)).toBe(1); - transactionThreadAction = _.filter(reportActionsForTransactionThread, (reportAction) => reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.IOU); + expect(_.size(reportActionsForTransactionThread)).toBe(3); + transactionThreadAction = _.find( + reportActionsForTransactionThread[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${transactionThreadReportID}`], + (reportAction) => reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.CREATED, + ); expect(transactionThreadAction.pendingAction).toBe(CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD); resolve(); }, @@ -749,7 +734,6 @@ describe('actions/IOU', () => { waitForCollectionCallback: true, callback: (transaction) => { Onyx.disconnect(connectionID); - console.log('TRANSACTION : ', transaction); expect(transaction.pendingAction).toBeFalsy(); expect(transaction.errors).toBeTruthy(); expect(_.values(transaction.errors)[0]).toBe('iou.error.genericCreateFailureMessage'); @@ -807,6 +791,7 @@ describe('actions/IOU', () => { () => new Promise((resolve) => { Report.deleteReport(chatReportID); + Report.deleteReport(transactionThreadReportID); resolve(); }), ) @@ -836,7 +821,6 @@ describe('actions/IOU', () => { waitForCollectionCallback: true, callback: (allReportActions) => { Onyx.disconnect(connectionID); - console.log('ALL REPORT ACTIONS : ', allReportActions); _.each(allReportActions, (reportAction) => expect(reportAction).toBeFalsy()); resolve(); }, @@ -863,7 +847,7 @@ describe('actions/IOU', () => { // Cleanup .then(fetch.succeed) ); - }, 10000); + }, 25000); }); describe('split bill', () => { @@ -1008,8 +992,8 @@ describe('actions/IOU', () => { callback: (allReports) => { Onyx.disconnect(connectionID); - // There should now be 7 reports - expect(_.size(allReports)).toBe(7); + // There should now be 10 reports + expect(_.size(allReports)).toBe(10); // 1. The chat report with Rory + Carlos carlosChatReport = _.find(allReports, (report) => report.reportID === carlosChatReport.reportID); @@ -1078,10 +1062,9 @@ describe('actions/IOU', () => { waitForCollectionCallback: true, callback: (allReportActions) => { Onyx.disconnect(connectionID); - console.log("HERE'S ALL THE REPORT ACTIONS: ", allReportActions); - // There should be reportActions on all 4 chat reports + 3 IOU reports in each 1:1 chat - expect(_.size(allReportActions)).toBe(7); + // There should be reportActions on all 4 chat reports + 3 IOU reports in each 1:1 chat + 3 transaction thread actions + expect(_.size(allReportActions)).toBe(10); const carlosReportActions = allReportActions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${carlosChatReport.iouReportID}`]; const julesReportActions = allReportActions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${julesChatReport.iouReportID}`]; @@ -1294,7 +1277,7 @@ describe('actions/IOU', () => { callback: (allReports) => { Onyx.disconnect(connectionID); - expect(_.size(allReports)).toBe(2); + expect(_.size(allReports)).toBe(3); chatReport = _.find(allReports, (report) => report.type === CONST.REPORT.TYPE.CHAT); expect(chatReport).toBeTruthy(); @@ -1375,7 +1358,7 @@ describe('actions/IOU', () => { callback: (allReports) => { Onyx.disconnect(connectionID); - expect(_.size(allReports)).toBe(2); + expect(_.size(allReports)).toBe(3); chatReport = _.find(allReports, (r) => r.type === CONST.REPORT.TYPE.CHAT); iouReport = _.find(allReports, (r) => r.type === CONST.REPORT.TYPE.IOU); @@ -1426,7 +1409,7 @@ describe('actions/IOU', () => { callback: (allReports) => { Onyx.disconnect(connectionID); - expect(_.size(allReports)).toBe(2); + expect(_.size(allReports)).toBe(3); chatReport = _.find(allReports, (r) => r.type === CONST.REPORT.TYPE.CHAT); iouReport = _.find(allReports, (r) => r.type === CONST.REPORT.TYPE.IOU); @@ -1467,7 +1450,7 @@ describe('actions/IOU', () => { }); }), ); - }, 10000); + }, 15000); }); describe('edit money request', () => { From 23abb8210717f494f7e308d6b2453a14f16890f8 Mon Sep 17 00:00:00 2001 From: Daniel Edwards Date: Wed, 13 Dec 2023 15:44:47 -0500 Subject: [PATCH 6/8] Remove unused import --- .tool-versions | 1 + tests/actions/IOUTest.js | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 .tool-versions diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 000000000000..c2ca3d3d25e3 --- /dev/null +++ b/.tool-versions @@ -0,0 +1 @@ +nodejs 20.9.0 diff --git a/tests/actions/IOUTest.js b/tests/actions/IOUTest.js index fec8a38f1c6f..cc70cd906085 100644 --- a/tests/actions/IOUTest.js +++ b/tests/actions/IOUTest.js @@ -1,4 +1,3 @@ -import {tr} from 'date-fns/locale'; import Onyx from 'react-native-onyx'; import _ from 'underscore'; import CONST from '../../src/CONST'; From df4959a3c408e6e57e6c854149273527cef2af23 Mon Sep 17 00:00:00 2001 From: Daniel Edwards Date: Wed, 13 Dec 2023 15:48:40 -0500 Subject: [PATCH 7/8] Remove unneeded timeout --- tests/actions/IOUTest.js | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/tests/actions/IOUTest.js b/tests/actions/IOUTest.js index cc70cd906085..f37c8968de20 100644 --- a/tests/actions/IOUTest.js +++ b/tests/actions/IOUTest.js @@ -49,7 +49,6 @@ describe('actions/IOU', () => { }); describe('requestMoney', () => { - jest.setTimeout(30000); it('creates new chat if needed', () => { const amount = 10000; const comment = 'Giv money plz'; @@ -385,7 +384,7 @@ describe('actions/IOU', () => { }); }), ); - }, 10000); + }); it('updates existing IOU report if there is one', () => { const amount = 10000; @@ -568,7 +567,7 @@ describe('actions/IOU', () => { }); }), ); - }, 10000); + }); it('correctly implements RedBrickRoad error handling', () => { const amount = 10000; @@ -846,7 +845,7 @@ describe('actions/IOU', () => { // Cleanup .then(fetch.succeed) ); - }, 25000); + }); }); describe('split bill', () => { @@ -1253,7 +1252,7 @@ describe('actions/IOU', () => { }); }), ); - }, 10000); + }); }); describe('payMoneyRequestElsewhere', () => { @@ -1449,7 +1448,7 @@ describe('actions/IOU', () => { }); }), ); - }, 15000); + }); }); describe('edit money request', () => { @@ -1725,7 +1724,7 @@ describe('actions/IOU', () => { }); }), ); - }, 10000); + }); }); describe('pay expense report via ACH', () => { @@ -1846,7 +1845,7 @@ describe('actions/IOU', () => { }); }), ); - }, 10000); + }); it('shows an error when paying results in an error', () => { let expenseReport = {}; @@ -1912,7 +1911,7 @@ describe('actions/IOU', () => { }); }), ); - }, 10000); + }); }); describe('deleteMoneyRequest', () => { @@ -2571,7 +2570,7 @@ describe('actions/IOU', () => { expect(iouReport).toHaveProperty('chatReportID'); expect(iouReport.hasOutstandingIOU).toBeTruthy(); expect(iouReport.total).toBe(20000); - }, 10000); + }); it('navigate the user correctly to the iou Report when appropriate', async () => { await waitForBatchedUpdates(); @@ -2792,7 +2791,7 @@ describe('actions/IOU', () => { }); }), ); - }, 10000); + }); it('correctly implements error handling', () => { const amount = 10000; const comment = '💸💸💸💸'; @@ -2892,6 +2891,6 @@ describe('actions/IOU', () => { }); }), ); - }, 10000); + }); }); }); From 242cb21302311465c72500279e7b1c61df1fc744 Mon Sep 17 00:00:00 2001 From: Daniel Edwards Date: Wed, 13 Dec 2023 15:50:41 -0500 Subject: [PATCH 8/8] Delete .tool-versions Signed-off-by: Daniel Edwards --- .tool-versions | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .tool-versions diff --git a/.tool-versions b/.tool-versions deleted file mode 100644 index c2ca3d3d25e3..000000000000 --- a/.tool-versions +++ /dev/null @@ -1 +0,0 @@ -nodejs 20.9.0