From 86e12025495183be197e57e95aef5908e4a6b44d Mon Sep 17 00:00:00 2001 From: IF <139582705+infiniteflower@users.noreply.github.com> Date: Mon, 2 Dec 2024 11:18:40 -0500 Subject: [PATCH] fix: broken tests --- .../bridge-status-controller.test.ts.snap | 8 ++++++-- app/scripts/controllers/bridge-status/mocks.ts | 13 +++++++++++-- shared/types/bridge-status.ts | 10 ++++++---- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/app/scripts/controllers/bridge-status/__snapshots__/bridge-status-controller.test.ts.snap b/app/scripts/controllers/bridge-status/__snapshots__/bridge-status-controller.test.ts.snap index 2dbcf3f1b027..8bbeab6356d9 100644 --- a/app/scripts/controllers/bridge-status/__snapshots__/bridge-status-controller.test.ts.snap +++ b/app/scripts/controllers/bridge-status/__snapshots__/bridge-status-controller.test.ts.snap @@ -6,7 +6,9 @@ exports[`BridgeStatusController constructor rehydrates the tx history state 1`] "account": "0xaccount1", "estimatedProcessingTimeInSeconds": 15, "initialDestAssetBalance": undefined, - "pricingData": undefined, + "pricingData": { + "amountSent": "1.234", + }, "quote": { "bridgeId": "lifi", "bridges": [ @@ -113,7 +115,9 @@ exports[`BridgeStatusController startPollingForBridgeTxStatus sets the inital tx "account": "0xaccount1", "estimatedProcessingTimeInSeconds": 15, "initialDestAssetBalance": undefined, - "pricingData": undefined, + "pricingData": { + "amountSent": "1.234", + }, "quote": { "bridgeId": "lifi", "bridges": [ diff --git a/app/scripts/controllers/bridge-status/mocks.ts b/app/scripts/controllers/bridge-status/mocks.ts index d46157d3433b..1507af5830ec 100644 --- a/app/scripts/controllers/bridge-status/mocks.ts +++ b/app/scripts/controllers/bridge-status/mocks.ts @@ -4,6 +4,7 @@ import { StatusResponse, StatusTypes, ActionTypes, + StartPollingForBridgeTxStatusArgsSerialized, } from '../../../../shared/types/bridge-status'; export const MockStatusResponse = { @@ -210,7 +211,7 @@ export const getMockStartPollingForBridgeTxStatusArgs = ({ account = '0xaccount1', srcChainId = 42161, destChainId = 10, -} = {}) => ({ +} = {}): StartPollingForBridgeTxStatusArgsSerialized => ({ bridgeTxMeta: { id: txMetaId, } as TransactionMeta, @@ -235,10 +236,10 @@ export const getMockStartPollingForBridgeTxStatusArgs = ({ }, approval: null, estimatedProcessingTimeInSeconds: 15, + sentAmount: { amount: '1.234', fiat: null }, }, startTime: 1729964825189, slippagePercentage: 0, - pricingData: undefined, initialDestAssetBalance: undefined, targetContractAddress: '0x23981fC34e69eeDFE2BD9a0a9fCb0719Fe09DbFC', }); @@ -258,6 +259,8 @@ export const MockTxHistory = { slippagePercentage: 0, account, targetContractAddress: '0x23981fC34e69eeDFE2BD9a0a9fCb0719Fe09DbFC', + initialDestAssetBalance: undefined, + pricingData: { amountSent: '1.234' }, }, }), getInit: ({ @@ -274,6 +277,8 @@ export const MockTxHistory = { slippagePercentage: 0, account, targetContractAddress: '0x23981fC34e69eeDFE2BD9a0a9fCb0719Fe09DbFC', + initialDestAssetBalance: undefined, + pricingData: { amountSent: '1.234' }, }, }), getPending: ({ @@ -295,6 +300,8 @@ export const MockTxHistory = { srcChainId, }), targetContractAddress: '0x23981fC34e69eeDFE2BD9a0a9fCb0719Fe09DbFC', + initialDestAssetBalance: undefined, + pricingData: { amountSent: '1.234' }, }, }), getComplete: ({ @@ -313,6 +320,8 @@ export const MockTxHistory = { account, status: MockStatusResponse.getComplete({ srcTxHash }), targetContractAddress: '0x23981fC34e69eeDFE2BD9a0a9fCb0719Fe09DbFC', + initialDestAssetBalance: undefined, + pricingData: { amountSent: '1.234' }, }, }), }; diff --git a/shared/types/bridge-status.ts b/shared/types/bridge-status.ts index 6a36411b52ee..845a3c7cec65 100644 --- a/shared/types/bridge-status.ts +++ b/shared/types/bridge-status.ts @@ -158,10 +158,12 @@ export type StartPollingForBridgeTxStatusArgs = { targetContractAddress?: BridgeHistoryItem['targetContractAddress']; }; -export type StartPollingForBridgeTxStatusArgsSerialized = - StartPollingForBridgeTxStatusArgs & { - quoteResponse: QuoteResponse & QuoteMetadataSerialized; - }; +export type StartPollingForBridgeTxStatusArgsSerialized = Omit< + StartPollingForBridgeTxStatusArgs, + 'quoteResponse' +> & { + quoteResponse: QuoteResponse & QuoteMetadataSerialized; +}; export type SourceChainTxMetaId = string;