Skip to content

Commit

Permalink
fix: lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
infiniteflower committed Feb 6, 2025
1 parent f3a965c commit 3b32b87
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions packages/bridge-controller/src/utils/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable n/no-process-env */
import { abiERC20 } from '@metamask/metamask-eth-abis';
import type { Hex } from '@metamask/utils';
import { Contract } from 'ethers';
Expand All @@ -8,8 +9,13 @@ import {
isSwapsDefaultTokenAddress,
isSwapsDefaultTokenSymbol,
sumHexes,
getBridgeApiBaseUrl,
} from '.';
import { ETH_USDT_ADDRESS, METABRIDGE_ETHEREUM_ADDRESS } from '../constants';
import {
BRIDGE_DEV_API_BASE_URL,
BRIDGE_PROD_API_BASE_URL,
} from '../constants';
import { CHAIN_IDS } from '../constants/chains';
import { SWAPS_CHAINID_DEFAULT_TOKEN_MAP } from '../constants/tokens';

Expand Down Expand Up @@ -132,4 +138,30 @@ describe('Bridge utils', () => {
expect(isSwapsDefaultTokenSymbol('ETH', '' as Hex)).toBe(false);
});
});

describe('getBridgeApiBaseUrl', () => {
const originalEnv = process.env;

beforeEach(() => {
process.env = { ...originalEnv };
});

afterEach(() => {
process.env = originalEnv;
});

it('returns custom API URL when BRIDGE_CUSTOM_API_BASE_URL is set', () => {
process.env.BRIDGE_CUSTOM_API_BASE_URL = 'https://custom-api.example.com';
expect(getBridgeApiBaseUrl()).toBe('https://custom-api.example.com');
});

it('returns dev API URL when BRIDGE_USE_DEV_APIS is set', () => {
process.env.BRIDGE_USE_DEV_APIS = 'true';
expect(getBridgeApiBaseUrl()).toBe(BRIDGE_DEV_API_BASE_URL);
});

it('returns prod API URL by default', () => {
expect(getBridgeApiBaseUrl()).toBe(BRIDGE_PROD_API_BASE_URL);
});
});
});

0 comments on commit 3b32b87

Please sign in to comment.