From 3563a7c2526e0e18b63517c6ca78dbc4ea33a46c Mon Sep 17 00:00:00 2001 From: Mykhailo Kravchenko Date: Fri, 29 Sep 2023 16:36:26 +0200 Subject: [PATCH] fix unit-tests --- tests/actions/IOUTest.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/actions/IOUTest.js b/tests/actions/IOUTest.js index 3df3b137bab3..25ae453a865e 100644 --- a/tests/actions/IOUTest.js +++ b/tests/actions/IOUTest.js @@ -57,7 +57,10 @@ describe('actions/IOU', () => { let iouAction; let transactionID; fetch.pause(); - IOU.requestMoney({}, amount, CONST.CURRENCY.USD, '', merchant, RORY_EMAIL, RORY_ACCOUNT_ID, {login: CARLOS_EMAIL, accountID: CARLOS_ACCOUNT_ID}, comment); + Onyx.set(ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_CATEGORIES, {}).then(() => + IOU.requestMoney({}, amount, CONST.CURRENCY.USD, '', merchant, RORY_EMAIL, RORY_ACCOUNT_ID, {login: CARLOS_EMAIL, accountID: CARLOS_ACCOUNT_ID}, comment), + ); + return waitForBatchedUpdates() .then( () => @@ -221,6 +224,7 @@ describe('actions/IOU', () => { [createdAction.reportActionID]: createdAction, }), ) + .then(() => Onyx.set(ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_CATEGORIES, {})) .then(() => { IOU.requestMoney(chatReport, amount, CONST.CURRENCY.USD, '', '', RORY_EMAIL, RORY_ACCOUNT_ID, {login: CARLOS_EMAIL, accountID: CARLOS_ACCOUNT_ID}, comment); return waitForBatchedUpdates(); @@ -413,6 +417,7 @@ describe('actions/IOU', () => { }), ) .then(() => Onyx.set(`${ONYXKEYS.COLLECTION.TRANSACTION}${existingTransaction.transactionID}`, existingTransaction)) + .then(() => Onyx.set(ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_CATEGORIES, {})) .then(() => { IOU.requestMoney(chatReport, amount, CONST.CURRENCY.USD, '', '', RORY_EMAIL, RORY_ACCOUNT_ID, {login: CARLOS_EMAIL, accountID: CARLOS_ACCOUNT_ID}, comment); return waitForBatchedUpdates(); @@ -547,7 +552,10 @@ describe('actions/IOU', () => { let iouAction; let transactionID; fetch.pause(); - IOU.requestMoney({}, amount, CONST.CURRENCY.USD, '', '', RORY_EMAIL, RORY_ACCOUNT_ID, {login: CARLOS_EMAIL, accountID: CARLOS_ACCOUNT_ID}, comment); + Onyx.set(ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_CATEGORIES, {}).then(() => + IOU.requestMoney({}, amount, CONST.CURRENCY.USD, '', '', RORY_EMAIL, RORY_ACCOUNT_ID, {login: CARLOS_EMAIL, accountID: CARLOS_ACCOUNT_ID}, comment), + ); + return ( waitForBatchedUpdates() .then( @@ -901,6 +909,7 @@ describe('actions/IOU', () => { }), ) .then(() => Onyx.set(`${ONYXKEYS.COLLECTION.TRANSACTION}${julesExistingTransaction.transactionID}`, julesExistingTransaction)) + .then(() => Onyx.set(ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_CATEGORIES, {})) .then(() => { // When we split a bill offline fetch.pause();