Skip to content

Commit

Permalink
fix: rm tests for setting src tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
micaelae committed Jan 14, 2025
1 parent 89f88fa commit a5192d5
Show file tree
Hide file tree
Showing 10 changed files with 3 additions and 89 deletions.
3 changes: 0 additions & 3 deletions app/scripts/constants/sentry-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,6 @@ export const SENTRY_BACKGROUND_STATE = {
destTokens: {},
destTopAssets: [],
destTokensLoadingStatus: true,
srcTokens: {},
srcTopAssets: [],
srcTokensLoadingStatus: true,
quoteRequest: {
walletAddress: false,
srcTokenAddress: true,
Expand Down
35 changes: 1 addition & 34 deletions app/scripts/controllers/bridge/bridge-controller.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import mockBridgeQuotesErc20Native from '../../../../test/data/bridge/mock-quote
import mockBridgeQuotesNativeErc20 from '../../../../test/data/bridge/mock-quotes-native-erc20.json';
import mockBridgeQuotesNativeErc20Eth from '../../../../test/data/bridge/mock-quotes-native-erc20-eth.json';
import {
type QuoteResponse,
RequestStatus,
type QuoteResponse,
} from '../../../../shared/types/bridge';
import { decimalToHex } from '../../../../shared/modules/conversion.utils';
import BridgeController from './bridge-controller';
Expand Down Expand Up @@ -198,39 +198,6 @@ describe('BridgeController', function () {
});
});

it('selectSrcNetwork should set the bridge src tokens and top assets', async function () {
await bridgeController.selectSrcNetwork('0xa');
expect(bridgeController.state.bridgeState.srcTokens).toStrictEqual({
'0x0000000000000000000000000000000000000000': {
address: '0x0000000000000000000000000000000000000000',
decimals: 18,
iconUrl: './images/eth_logo.svg',
name: 'Ether',
symbol: 'ETH',
},
'0x1f9840a85d5af5bf1d1762f925bdaddc4201f984': {
address: '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984',
symbol: 'ABC',
decimals: 16,
aggregators: ['lifl', 'socket'],
},
});
expect(
bridgeController.state.bridgeState.srcTokensLoadingStatus,
).toStrictEqual(RequestStatus.FETCHED);
expect(bridgeController.state.bridgeState.srcTopAssets).toStrictEqual([
{
address: '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984',
symbol: 'ABC',
},
]);
expect(bridgeController.state.bridgeState.quoteRequest).toStrictEqual({
slippage: 0.5,
srcTokenAddress: '0x0000000000000000000000000000000000000000',
walletAddress: undefined,
});
});

it('updateBridgeQuoteRequestParams should update the quoteRequest state', function () {
bridgeController.updateBridgeQuoteRequestParams({ srcChainId: 1 });
expect(bridgeController.state.bridgeState.quoteRequest).toStrictEqual({
Expand Down
2 changes: 0 additions & 2 deletions test/e2e/default-fixture.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,6 @@ function defaultFixture(inputChainId = CHAIN_IDS.LOCALHOST) {
},
destTokens: {},
destTopAssets: [],
srcTokens: {},
srcTopAssets: [],
},
},
CurrencyController: {
Expand Down
2 changes: 0 additions & 2 deletions test/e2e/fixture-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -458,8 +458,6 @@ class FixtureBuilder {
},
destTokens: {},
destTopAssets: [],
srcTokens: {},
srcTopAssets: [],
},
};
return this;
Expand Down
1 change: 0 additions & 1 deletion test/e2e/tests/metrics/errors.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,6 @@ describe('Sentry errors', function () {
walletAddress: false,
},
destTokensLoadingStatus: false,
srcTokensLoadingStatus: false,
quotesLastFetched: true,
quotesLoadingStatus: true,
quotesRefreshCount: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@
"chains": { "0x1": "object", "0xa4b1": "object", "0xe708": "object" }
}
},
"srcTokens": {},
"srcTopAssets": {},
"destTokens": {},
"destTopAssets": {},
"quoteRequest": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,6 @@
"chains": { "0x1": "object", "0xa4b1": "object", "0xe708": "object" }
}
},
"srcTokens": {},
"srcTopAssets": {},
"destTokens": {},
"destTopAssets": {},
"quoteRequest": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,7 @@
}
},
"destTokens": {},
"destTopAssets": {},
"srcTokens": {},
"srcTopAssets": {}
"destTopAssets": {}
}
},
"SubjectMetadataController": { "subjectMetadata": "object" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,7 @@
}
},
"destTokens": {},
"destTopAssets": {},
"srcTokens": {},
"srcTopAssets": {}
"destTopAssets": {}
}
},
"TransactionController": { "transactions": "object" },
Expand Down
37 changes: 0 additions & 37 deletions ui/ducks/bridge/selectors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {
getFromChain,
getFromChains,
getFromToken,
getFromTokens,
getIsBridgeTx,
getToChain,
getToChains,
Expand Down Expand Up @@ -499,42 +498,6 @@ describe('Bridge selectors', () => {
});
});

describe('getFromTokens', () => {
it('returns src tokens from controller state', () => {
const state = createBridgeMockStore({
bridgeSliceOverrides: { toChainId: '0x1' },
bridgeStateOverrides: {
srcTokens: { '0x00': { address: '0x00', symbol: 'TEST' } },
srcTopAssets: [{ address: '0x01', symbol: 'SYMB' }],
},
});
const result = getFromTokens(state as never);

expect(result).toStrictEqual({
fromTokens: {
'0x00': { address: '0x00', symbol: 'TEST' },
},
fromTopAssets: [{ address: '0x01', symbol: 'SYMB' }],
isLoading: false,
});
});

it('returns src top assets from controller state', () => {
const state = createBridgeMockStore({
bridgeSliceOverrides: { toChainId: '0x1' },
bridgeStateOverrides: {
srcTokens: { '0x00': { address: '0x00', symbol: 'TEST' } },
srcTopAssets: [{ address: '0x00', symbol: 'TEST' }],
},
});
const result = getFromTokens(state as never);

expect(result.fromTopAssets).toStrictEqual([
{ address: '0x00', symbol: 'TEST' },
]);
});
});

describe('getBridgeQuotes', () => {
it('returns quote list and fetch data, insufficientBal=false,quotesRefreshCount=5', () => {
const state = createBridgeMockStore({
Expand Down

0 comments on commit a5192d5

Please sign in to comment.