From 5eef594dacb74f7b738b03cf6bb922277b397414 Mon Sep 17 00:00:00 2001 From: Shane Terence Odlum Date: Fri, 6 Dec 2024 15:16:46 +0000 Subject: [PATCH] fix: test coverage --- .../transaction-controller/src/TransactionController.test.ts | 3 +++ packages/transaction-controller/src/TransactionController.ts | 2 +- packages/transaction-controller/src/api/accounts-api.test.ts | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/transaction-controller/src/TransactionController.test.ts b/packages/transaction-controller/src/TransactionController.test.ts index 020efaa7f55..763bb4469de 100644 --- a/packages/transaction-controller/src/TransactionController.test.ts +++ b/packages/transaction-controller/src/TransactionController.test.ts @@ -5231,6 +5231,9 @@ describe('TransactionController', () => { }); it.each([ + { + newStatus: TransactionStatus.signed, + }, { newStatus: TransactionStatus.submitted, }, diff --git a/packages/transaction-controller/src/TransactionController.ts b/packages/transaction-controller/src/TransactionController.ts index 68ebf4c3df4..ad879139ffb 100644 --- a/packages/transaction-controller/src/TransactionController.ts +++ b/packages/transaction-controller/src/TransactionController.ts @@ -1963,6 +1963,7 @@ export class TransactionController extends BaseController< status && ![ TransactionStatus.submitted, + TransactionStatus.signed, TransactionStatus.failed, ].includes(status) ) { @@ -1970,7 +1971,6 @@ export class TransactionController extends BaseController< `Cannot update custodial transaction with status: ${status}`, ); } - const updatedTransactionMeta = merge( {}, transactionMeta, diff --git a/packages/transaction-controller/src/api/accounts-api.test.ts b/packages/transaction-controller/src/api/accounts-api.test.ts index c5ccc5ecc79..a182af11d03 100644 --- a/packages/transaction-controller/src/api/accounts-api.test.ts +++ b/packages/transaction-controller/src/api/accounts-api.test.ts @@ -25,6 +25,7 @@ const CHAIN_ID_SUPPORTED = 1; const CHAIN_ID_UNSUPPORTED = 999; const FROM_ADDRESS = '0xSender'; const TO_ADDRESS = '0xRecipient'; +const SORT_DIRECTION_MOCK = 'ASC'; const ACCOUNT_RESPONSE_MOCK = { data: [{}], @@ -132,13 +133,14 @@ describe('Accounts API', () => { cursor: CURSOR_MOCK, endTimestamp: END_TIMESTAMP_MOCK, startTimestamp: START_TIMESTAMP_MOCK, + sortDirection: SORT_DIRECTION_MOCK, }); expect(response).toStrictEqual(ACCOUNT_RESPONSE_MOCK); expect(fetchMock).toHaveBeenCalledTimes(1); expect(fetchMock).toHaveBeenCalledWith( - `https://accounts.api.cx.metamask.io/v1/accounts/${ADDRESS_MOCK}/transactions?networks=${CHAIN_IDS_MOCK[0]},${CHAIN_IDS_MOCK[1]}&startTimestamp=${START_TIMESTAMP_MOCK}&endTimestamp=${END_TIMESTAMP_MOCK}&cursor=${CURSOR_MOCK}`, + `https://accounts.api.cx.metamask.io/v1/accounts/${ADDRESS_MOCK}/transactions?networks=${CHAIN_IDS_MOCK[0]},${CHAIN_IDS_MOCK[1]}&startTimestamp=${START_TIMESTAMP_MOCK}&endTimestamp=${END_TIMESTAMP_MOCK}&cursor=${CURSOR_MOCK}&sortDirection=${SORT_DIRECTION_MOCK}`, expect.any(Object), ); });